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

        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
        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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: