I need to use case statements in my query builder ...
My query looks 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' );
Please note that this is correct in MySQL.
I donβt know how to solve it ...
If you have another idea, feel free to help me :)
Any idea?
source share