Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2923

Query expressions ALL/ANY/SOME don't seem to work

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Invalid
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:
    • Environment:
      Doctrine 2.3 from a Symfony 2.4 application running on a Ubuntu 12.04 machine onder Apache / PHP.

      Description

      It seems that the query expressions ALL() / ANY() / SOME() don't work (anymore). See my testcase and the error on my stackoverflow question:

      http://stackoverflow.com/questions/21184374/doctrine-any-all-some-doesnt-work

      The exception is thrown in the Query/Parser.php (line: 3040) since the functions are not mapped in the parser class as string functions.

      What goes wrong?

        Activity

        Hide
        Marco Pivetta added a comment -

        Tests seem to cover this use case at https://github.com/doctrine/doctrine2/blob/a83f5df47c463cd64a2525274c97812e04a8eca5/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php#L418-L426 - try using plain DQL instead of the query builder first - may be a problem with the QB

        Show
        Marco Pivetta added a comment - Tests seem to cover this use case at https://github.com/doctrine/doctrine2/blob/a83f5df47c463cd64a2525274c97812e04a8eca5/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php#L418-L426 - try using plain DQL instead of the query builder first - may be a problem with the QB
        Hide
        Steve Müller added a comment -

        Kees Schepers You use the expression wrong. ALL/ANY/SOME expression needs another expression to compare against. Something like:

        SELECT * FROM foo WHERE ALL(SELECT bar.id FROM bar WHERE bar.id > 100)
        

        is not valid SQL.

        What you want is something like:

        SELECT * FROM foo WHERE foo.id > ALL(SELECT bar.id FROM bar WHERE bar.id > 100)
        

        I hope you get what I mean, I don't know exactly what you supposed your query to do but I hope you get the point. This is not a Doctrine bug.

        See here for an example with the query builder: https://github.com/doctrine/doctrine2/blob/a83f5df47c463cd64a2525274c97812e04a8eca5/tests/Doctrine/Tests/ORM/QueryBuilderTest.php#L716-L729

        Show
        Steve Müller added a comment - Kees Schepers You use the expression wrong. ALL/ANY/SOME expression needs another expression to compare against. Something like: SELECT * FROM foo WHERE ALL( SELECT bar.id FROM bar WHERE bar.id > 100) is not valid SQL. What you want is something like: SELECT * FROM foo WHERE foo.id > ALL( SELECT bar.id FROM bar WHERE bar.id > 100) I hope you get what I mean, I don't know exactly what you supposed your query to do but I hope you get the point. This is not a Doctrine bug. See here for an example with the query builder: https://github.com/doctrine/doctrine2/blob/a83f5df47c463cd64a2525274c97812e04a8eca5/tests/Doctrine/Tests/ORM/QueryBuilderTest.php#L716-L729
        Hide
        Benjamin Eberlei added a comment -

        Not an issue, the `andWhere($expr->all())` usage is wrong.

        Show
        Benjamin Eberlei added a comment - Not an issue, the `andWhere($expr->all())` usage is wrong.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Kees Schepers
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: