Skip to content


DDC-2322: [GH-592] Added ability to specify INDEX BY when creating a QueryBuilder from a Repository #3026

doctrinebot opened this Issue · 5 comments

2 participants


Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of cmenning:

Url: #592


This is a handy shortcut when using indexed results.


Comment created by @beberlei:

A related Github Pull-Request [GH-592] was closed


Issue was closed with resolution "Invalid"


Comment created by cmenning:

I disagree with the reasoning behind closing this request. In DoctrineBundle, getDoctrine()->getEntityManager() has been deprecated, which leaves you to use getDoctrine()->getRepository($class)->createQueryBuilder();

Adding ->from() at that point is redundant since it's already been specified inside the createQueryBuilder() call. It seems wasteful to not allow a passthru of the $indexBy argument during the initial call when it's already supported by the from() called inside createQueryBuilder().


Comment created by @ocramius:

The repository is already (probably) doing too much. A simpler approach with:

$qb = $em->createQueryBuilder()->select('e')->from($repo->getClassName(), 'e', 'e.stuff')

Is no big deal in my opinion.


Comment created by @doctrinebot:

A related Github Pull-Request [GH-592] was closed:

@beberlei beberlei was assigned by doctrinebot
@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.