mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1242: WHERE clause with OR is not surrounded by parentheses #1565
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jul 1, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user hype:
Found a BC break in 2.1.0RC2.
echo $qb->select('e')->from('SomeEntity', 'e')->where('1 = 1')->andWhere('2 = 2 OR 3 = 3')->getDQL();
The above query with an OR inside a where clause creates the following DQL in 2.0.6:
SELECT e FROM SomeEntity e WHERE (1 = 1) AND (2 = 2 OR 3 = 3)
But in 2.1.0RC2 it creates this DQL:
SELECT e FROM SomeEntity e WHERE 1 = 1 AND 2 = 2 OR 3 = 3
Which is obviously not what I want. Manually putting parentheses inside the andWhere or using $qb->expr()->or(...) inside the andWhere fixes this.
@doctrinebot commented on GitHub (Jul 3, 2011):
Comment created by @beberlei:
Duplicate of DDC-1237
@doctrinebot commented on GitHub (Jul 3, 2011):
Issue was closed with resolution "Duplicate"