Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANY should accept text[] field, currently throw a Expected Doctrine\ORM\Query\Lexer::T_SELECT #138

Open
allan-simon opened this issue May 31, 2023 · 2 comments

Comments

@allan-simon
Copy link

i.e if I have a field featureFlags which is declared as text[]

and I try to do

       $this->em->createQuery("

            SELECT u FROM App\Entity\EndUser u
            WHERE 'something' = ANY(u.featureFlags)
        ");

I got Expected Doctrine\ORM\Query\Lexer::T_SELECT, got 'u'

whereas if i type directly in postgresql

SELECT * FROM end_users WHERE 'something' = ANY (feature_flags)

it works

@TomLorenzi
Copy link

TomLorenzi commented Aug 10, 2023

As I'm working with my own DQL, the best solution for that would be to change the name of the called function.
Doctrine only expect sub select as parameters, so it will trigger your error.
Renaming ANY() to CUSTOM_ANY() as an example would allow you in your request to have something like this SELECT * FROM end_users WHERE 'something' = CUSTOM_ANY(feature_flags);

This will bypass the doctrine verification of ANY parameters and work

EDIT: looking at the docs, you should use ANY_OF() here, and it will do what I said above. @allan-simon

@klobastov
Copy link

same deprecatino for MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Cast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants