I'm trying to personalize a symfony 2.4
repository query to retrieve only some fields. Everything is ok with flat fields but when retrieving Entity fields, I only get the id (by default) but not the whole entity data. My query:
$select = $this->createQueryBuilder('ca')
->select('ca.id, ca.name')
->leftJoin('ca.users', 'user')
->addSelect('(user) as users');
$select->setMaxResults($count);
return $select->getQuery()->getResult();
The result is: [{id: 1, name: "Some name", users: 1}, ...]
How can I change this query for users to contain the whole user data, like id, name, address, etc.?