I want to group data by year and month of a date column using doctrine. It currently uses the query builder to produce the statement which is working fine apart from the grouping. I have installed the Month and Year custom functions from the Doctrine Extensions pack, however, I cannot do the following:
$qb->add('groupBy', 'MONTH(i.instdate)');
I get an Error: Cannot group by undefined identification variable message.
Is this possible with the query builder? If not can I add DQL to a query builder result? What is the best way to do this? I don't want to change the whole system to DQL as it is a query built from form options on the fly, so that would be a major change.