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

Like expression with case statement error #11819

Open
cbichis opened this issue Feb 4, 2025 · 0 comments
Open

Like expression with case statement error #11819

cbichis opened this issue Feb 4, 2025 · 0 comments

Comments

@cbichis
Copy link

cbichis commented Feb 4, 2025

Hello,
Its seems a QueryBuilder CASE statement combined with a LIKE is throwing this error:

Error: Expected =, <, <=, <>, >, >=, !=, got 'LIKE'

A similar issue was reported some time ago but only on "Discussions" part of the site, i'll paste here the DQL:

SELECT u, CASE WHEN u.roles LIKE '%ROLE_SUPER_ADMIN%' THEN 'Admin' ELSE '' END AS role
FROM App\Entity\User u
WHERE (CASE WHEN u.roles LIKE '%ROLE_SUPER_ADMIN%' THEN 'Admin' ELSE '' END LIKE :filter0_0)

and I got the error [Syntax Error] line 0, col 936: Error: Expected =, <, <=, <>, >, >=, !=, got 'LIKE'

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

1 participant