Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2113

SQLFilter incorrect results when WHERE clause contains OR expression

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.2, 2.3, Git Master
    • Fix Version/s: 2.3.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      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.

        Activity

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Vaughn Clayton
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: