SocialWork: Current actions filter + aggregator

This commit is contained in:
2022-10-31 11:43:41 +01:00
parent 8527c19073
commit a0fc9d4de5
3 changed files with 22 additions and 9 deletions

View File

@@ -25,7 +25,11 @@ class CurrentActionAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('AS acpw_current_action_aggregator')
$qb
->addSelect('
(CASE true WHEN acpw.startDate IS NULL ELSE false END)
AS acpw_current_action_aggregator
')
->addGroupBy('acpw_current_action_aggregator');
}
@@ -45,6 +49,17 @@ class CurrentActionAggregator implements AggregatorInterface
if ('_header' === $value) {
return '';
}
switch ($value) {
case true:
return 'Current action';
case false:
return 'Not current action';
default:
throw new \LogicException(sprintf('The value %s is not valid', $value));
}
};
}