Skip to content

Loading…

DDC-1335: QueryBuilder->form() does not allow the INDEX BY clause #1951

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user acasademont:

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.

@doctrinebot

Comment created by sandermarechal:

I too would like to see this. I thought this issue was fixed with DDC-1145 but 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();
@doctrinebot

Comment created by @guilhermeblanco:

Fixed in 80284a2

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.1.3 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.