[DDC-2322] [GH-592] Added ability to specify INDEX BY when creating a QueryBuilder from a Repository Created: 27/Feb/13  Updated: 01/May/14  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2, 2.3, Git Master
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: QueryBuilder, Repository


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

Url: https://github.com/doctrine/doctrine2/pull/592


This is a handy shortcut when using indexed results.

Comment by Benjamin Eberlei [ 12/Mar/13 ]

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

Comment by Craig Menning [ 12/Mar/13 ]

I disagree with the reasoning behind closing this request. In DoctrineBundle,


has been deprecated, which leaves you to use


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 by Marco Pivetta [ 12/Mar/13 ]

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 by Doctrine Bot [ 01/May/14 ]

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

Generated at Mon Nov 30 17:35:21 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.