Good day, everyone!
I have following Doctrine query to retrieve some CTI entities:
SELECT s.id
FROM CRM\SpendBundle\Entity\Spend s
WHERE (CASE
WHEN s INSTANCE OF 'CRM\BusinessTripBundle\Entity\BusinessTrip' THEN 'Business Trip'
WHEN s INSTANCE OF 'CRM\ExpenseRequestBundle\Entity\ExpenseRequest' THEN 'Expense Request'
ELSE '' END) IN(:availableSpends)
Parameter availableSpends is just an array of strings:
availableSpends = array('Expense Request')
And this query throws an error:
[Syntax Error] line 0, col 439: Error: Expected =, <, <=, <>, >, >=, !=, got 'IN'
What can i do with CASE statement to avoid this error? Doctrine version is 2.5.1