Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2046

QueryBuilder allows joining with the same alias multiple times

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor 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

        Hide
        Marco Pivetta added a comment -

        Attaching failing test case

        Show
        Marco Pivetta added a comment - Attaching failing test case
        Hide
        Marco Pivetta added a comment -

        The query builder should not worry about validity of produced DQL

        Show
        Marco Pivetta added a comment - The query builder should not worry about validity of produced DQL

          People

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

            Dates

            • Created:
              Updated:
              Resolved: