Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2046

QueryBuilder allows joining with the same alias multiple times

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      Currently, QueryBuilder allows assembling broken DQL like

      SELECT u FROM User u JOIN u.posts p JOIN u.logs p

      or

      SELECT u FROM User u JOIN u.posts u

      It may be interesting if we either replace DQL parts by associating them to their alias.

      Another solution, since Alexander noted that it is a dumb string builder, is to throw exceptions early to disallow broken DQL generation (such as in the second case).

      It may also be useful to allow giving insights about the currently existing joined aliases.

      public function hasJoinedAlias($alias);

        Activity

        ocramius Marco Pivetta created issue -
        ocramius Marco Pivetta made changes -
        Field Original Value New Value
        Attachment DDC2046Test.php [ 11328 ]
        ocramius Marco Pivetta made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]

          People

          • Assignee:
            ocramius Marco Pivetta
            Reporter:
            ocramius Marco Pivetta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: