addSelect("to_char(cal.startDate, 'MM-YYYY') AS month_year_aggregator"); // $qb->addSelect("extract(month from age(cal.startDate, cal.endDate)) AS month_aggregator"); $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { $qb->addGroupBy('month_year_aggregator'); } else { $qb->groupBy('month_year_aggregator'); } } public function applyOn(): string { return Declarations::CALENDAR_TYPE; } }