mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
DX: do not use complicated condtiion to add a group by
This commit is contained in:
parent
c7de95c635
commit
f5997e39cd
@ -40,14 +40,7 @@ final class LocationAggregator implements AggregatorInterface
|
||||
$qb->join('cal.location', 'calloc');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(cal.location) as location_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('location_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('location_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('location_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -28,13 +28,7 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
{
|
||||
$qb->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');
|
||||
}
|
||||
$qb->addGroupBy('month_year_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -54,10 +48,7 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
return 'by month and year';
|
||||
}
|
||||
|
||||
$month = substr($value, 0, 2);
|
||||
$year = substr($value, 3, 4);
|
||||
|
||||
return strftime('%B %G', mktime(0, 0, 0, $month, '1', $year));
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -46,14 +46,7 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(caluser.mainScope) as scope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('scope_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
Loading…
x
Reference in New Issue
Block a user