Ticket #939 (closed defect: fixed)
OR has precedence over AND
| Reported by: | frosas | Owned by: | romanb |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Query/Hydration | Version: | 0.11.0 |
| Keywords: | Cc: | ||
| Has Test: | Status: | ||
| Has Patch: |
Description
It happens that in DQL the logical operator OR has precedence over AND, which it neither behaves according to common sense nor the manual.
I'll use the Doctrine_Query_Condition unit test code as example. The WHERE condition:
(User.name LIKE 'z%') OR User.name LIKE 's%' AND User.name LIKE 'a%'
is expected to become:
(e.name LIKE 'z%' OR (e.name LIKE 's%' AND e.name LIKE 'a%'))
(note the brackets are opcional) but this is what we get:
((e.name LIKE 'z%' OR e.name LIKE 's%') AND e.name LIKE 'a%')
Attached is the patch that hopefully solves this.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.