Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1260

Enable nesting of OR and AND statements in DQL queries

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      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...

        Issue Links

          Activity

          Andreas Förthner created issue -
          Hide
          Guilherme Blanco added a comment -

          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.

          Show
          Guilherme Blanco added a comment - 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.
          Benjamin Eberlei made changes -
          Field Original Value New Value
          Link This issue is duplicated by DDC-1255 [ DDC-1255 ]
          Benjamin Eberlei made changes -
          Link This issue is required for DDC-1299 [ DDC-1299 ]
          Hide
          Guilherme Blanco added a comment -

          In this commit: https://github.com/doctrine/doctrine2/commit/816ce41f638d28934c79a12ef27f954124b2639e
          I applied the support to this improvement, since it does not mess with generated code.

          Show
          Guilherme Blanco added a comment - In this commit: https://github.com/doctrine/doctrine2/commit/816ce41f638d28934c79a12ef27f954124b2639e I applied the support to this improvement, since it does not mess with generated code.
          Guilherme Blanco made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
          Fix Version/s 2.2-DEV [ 10157 ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 12803 ] jira-feedback [ 14940 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback [ 14940 ] jira-feedback2 [ 16804 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 16804 ] jira-feedback3 [ 19057 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1260, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Guilherme Blanco
              Reporter:
              Andreas Förthner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: