mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
SocialWork: Current actions filter + aggregator
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -25,11 +25,7 @@ class CurrentActionFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->in('', ':')
|
||||
)
|
||||
->setParameter('', $data[]);
|
||||
$qb->andWhere('acpw.startDate IS NULL');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -39,13 +35,12 @@ class CurrentActionFilter implements FilterInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add();
|
||||
//no form
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
return ['', [
|
||||
]];
|
||||
return ['Filtered by current action'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
Reference in New Issue
Block a user