Details
Description
The QueryBuilder does not allow the INDEX BY clause in the form() function, so queris like 'SELECT u FROM User u INDEX BY u.id' are not possible just using the QueryBuilder. There is the option in the join() functions but when a join is not needed, you can only use DQL.
If you find id appropiate i'll work on a patch for the issue.
I too would like to see this. I thought this issue was fixed with
DDC-1145but that only solves it for joins. It does not allow indexing on the result itself. I would like to see something like this:$builder->select('u')->from('User')->indexBy('u.id'); $builder->getQuery()->getResult();Or it may be better to implement it on the query (since it affects hydration rather than the query itself):
$builder->select('u')->from('User'); $builder->getQuery()->setIndex('u.id')->getResult();