DDC-2923: Query expressions ALL/ANY/SOME don't seem to work #3683

Closed
doctrinebot opened this Issue Jan 17, 2014 · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user keesschepers:

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?

@doctrinebot

Comment created by @ocramius:

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

@doctrinebot

Comment created by @deeky666:

[~keesschepers] 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

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Issue was closed with resolution "Invalid"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment