mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
cancel reason aggregator + start of monthYearAggregator
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user