[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


 Description   

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

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

Message:

This is a handy shortcut when using indexed results.



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

A related Github Pull-Request [GH-592] was closed
https://github.com/doctrine/doctrine2/pull/592

Comment by Craig Menning [ 12/Mar/13 ]

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 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:
https://github.com/doctrine/dbal/pull/592

Generated at Thu Oct 30 12:27:41 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.