Details
Description
When using an SQLFilter, if applied to a query that contains only OR expressions in the WHERE clause, the generated SQL is incorrect.
Example:
- SQLFilter returns a constraint like "{$tableAlias}.accountid={$accountId}"
- Query: "SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob'"
Resulting SQL:
"SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob' AND u.accountid=2"
Expected:
"SELECT u FROM User u WHERE (u.fname='bob' OR u.lname='bob') AND u.accountid=2"
The problem is that the order of operations is wrong. I'm getting users who aren't in account 2, making SQLFilter unreliable.
Fixed : https://github.com/doctrine/doctrine2/commit/129d6efd8585458fd4bde2a3eb9a5cac374f54fe