cancel reason aggregator + start of monthYearAggregator

This commit is contained in:
2022-08-25 09:27:30 +02:00
parent 2bf5e934e9
commit 9854fb0664
4 changed files with 119 additions and 5 deletions

View File

@@ -14,12 +14,20 @@ class MonthYearAggregator implements AggregatorInterface
public function getQueryKeys($data): array
{
return ['monty_year_aggregator'];
return ['month_year_aggregator'];
}
public function getLabels($key, array $values, $data): Closure
{
dump($values);
$labels = [];
return static function (string $value) use ($labels): string {
return $labels[$value];
};
}
public function buildForm(FormBuilderInterface $builder)
@@ -39,11 +47,21 @@ class MonthYearAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
// TODO: Implement alterQuery() method.
$qb->addSelect('MONTH(:startDate), YEAR(:startDate) as month_year_aggregator');
// $qb->addSelect('YEAR(cal.startDate) as year_aggregator');
$qb->setParameter('startDate', 'cal.startDate');
$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 ];
return Declarations::CALENDAR_TYPE;
}
}