mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Condition using "CASE WHEN" not expecting "LIKE" keyword #6868
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @davidherdu on GitHub (Nov 5, 2021).
Bug Report
DQL:
Error:
[Syntax Error] line 0, col 283: Error: Expected =, <, <=, <>, >, >=, !=, got 'LIKE'
If I change "LIKE :filter" for "= :filter" it works.
The query works in Sequel Pro or MySQL Workbench without switching
=byLIKESummary
Doctrine should accept "LIKE" operator when the left operand is a "CASE WHEN" (DQL)
Current behavior
Doctrine is not accepting "LIKE" when the left operand is a "CASE WHEN"
How to reproduce
$q = $em->createQuery('SELECT u FROM App\Entity\User u WHERE CASE WHEN u.roles LIKE '%ROLE_SUPER_ADMIN%' THEN 'Admin' ELSE '' END LIKE :filter');
$cgs = $q->getResult();
Expected behavior
The DQL above run without any error