I have to use case statements
into my query builder...
My query is something like this:
$query = $this->getEntityManager('V')->createQuery(
'SELECT V,
(CASE unit WHEN "DAY" THEN DATE_ADD( NOW() , INTERVAL start_date DAY )
WHEN "MONTH" THEN DATE_ADD( NOW() , INTERVAL start_date MONTH )
WHEN "YEAR" THEN DATE_ADD( NOW() , INTERVAL start_date YEAR )
END as startDate
)
FROM AppMyBundle:Entity V
WHERE 1=1
ORDER BY date ASC'
);
Note that it is correct in MySQL.
I don't know how to solve it...
If you have another idea, feel free to help me :)
Any idea?
Try this one I hope it working for you Thanks, Ashok Chitroda