Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2322

[GH-592] Added ability to specify INDEX BY when creating a QueryBuilder from a Repository

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 2.2, 2.3, Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All

      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.

        Activity

        Benjamin Eberlei created issue -
        Craig Menning made changes -
        Field Original Value New Value
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Craig Menning made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Craig Menning made changes -
        Affects Version/s Git Master [ 10100 ]
        Affects Version/s 2.3 [ 10185 ]
        Affects Version/s 2.2 [ 10157 ]
        Craig Menning made changes -
        Component/s ORM [ 10012 ]
        Craig Menning made changes -
        Labels QueryBuilder
        Craig Menning made changes -
        Labels QueryBuilder QueryBuilder Repository
        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-592] was closed https://github.com/doctrine/doctrine2/pull/592
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        Craig Menning added a comment -

        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().

        Show
        Craig Menning added a comment - 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().
        Hide
        Marco Pivetta added a comment -

        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.

        Show
        Marco Pivetta added a comment - 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.
        Hide
        Doctrine Bot added a comment -

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

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-592] was closed: https://github.com/doctrine/dbal/pull/592

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2322, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: