DDC-1260: Enable nesting of OR and AND statements in DQL queries #1871

doctrinebot opened this Issue Jul 8, 2011 · 4 comments

2 participants


Jira issue originally created by user t3andi:

Currently it is not allowed to nest AND and OR conditions in themselves. However, this comes in handy if you try to do a dynamic query rewriting, where you want to add some more conditions without knowing the original query before.

The fix is trivial, just allow to add AND in AND. The same needs to be done for OR. Patch will follow in a second...


Comment created by @guilhermeblanco:

This can lead to unpredictable situations inside QueryBuilder.
Maybe we can add a "merge" function to Expr\Composite, I'm not sure.

I need to actually test it on every driver to make sure if it doesn't break anything. It was not originally designed to hold same instances. If you pay attention:

((a AND b) AND c) 

Is the same as:

a AND b AND c

Can't you make a check internally and use addMultiple?
In the meantime, I can make tests to check if it doesn't break anything else.


Comment created by @guilhermeblanco:

In this commit: 816ce41
I applied the support to this improvement, since it does not mess with generated code.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment