-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Dinesh0204/orm
#1Description
Bug Report
Q | A |
---|---|
Version | 3.5.2 |
Summary
Using the querybuilder, using CASE WHEN + IN produces an error.
Using CASE WHEN with any other comparison works just fine
Current behavior
->andWhere("
CASE
WHEN o.prop1 IS NOT NULL THEN o.propX
WHEN o.prop2 IS NOT NULL THEN o.propY
ELSE o.propZ
END IN (:values)
")
Produces:
[Syntax Error] line 0, col 911: Error: Expected =, <, <=, <>, >, >=, !=, got 'IN'
Indeed, using any of the listed operators work just fine.
I tried finding a workaround but didn't find any, all other alternative syntaxes produce the same issue.
Expected behavior
The above DQL works, as suggested by the SQL syntax.
How to reproduce
The first querybuilder works, where the second querybuilder doesn't:
$this
->userRepository
->createQueryBuilder('u')
->andWhere('CASE WHEN u.email IS NULL THEN u.email ELSE u.email END = :value')
->setParameter('value', 'test')
->getQuery()
->getResult();
$this
->userRepository
->createQueryBuilder('u')
->andWhere('CASE WHEN u.email IS NULL THEN u.email ELSE u.email END IN (:value)')
->setParameter('value', 'test')
->getQuery()
->getResult();
Thank you for the amazing work <3
Metadata
Metadata
Assignees
Labels
No labels