[DDC-2046] QueryBuilder allows joining with the same alias multiple times Created: 27/Sep/12  Updated: 23/Jan/13  Resolved: 23/Jan/13

Status: Closed
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: None

Attachments: File DDC2046Test.php    

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


 Comments   
Comment by Marco Pivetta [ 27/Sep/12 ]

Attaching failing test case

Comment by Marco Pivetta [ 23/Jan/13 ]

The query builder should not worry about validity of produced DQL

Generated at Wed Jul 30 07:12:12 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.