revert stepFilter to uniq selection

(cfr ddac410b2e)
This commit is contained in:
2022-07-25 18:24:24 +02:00
parent e728c00671
commit ef827a1322
2 changed files with 8 additions and 12 deletions

View File

@@ -39,8 +39,10 @@ class StepFilter implements FilterInterface
{
$builder->add('accepted_steps', ChoiceType::class, [
'choices' => self::STEPS,
'multiple' => true,
'multiple' => false,
'expanded' => true,
'empty_data' => self::DEFAULT_CHOICE,
'data' => self::DEFAULT_CHOICE,
]);
}
@@ -51,16 +53,10 @@ class StepFilter implements FilterInterface
public function describeAction($data, $format = 'string')
{
$steps = [];
$step = array_flip(self::STEPS)[$data['accepted_steps']];
foreach ($data['accepted_steps'] as $v) {
$steps[] = $this->translator->trans(
array_flip(self::STEPS)[$v]
);
}
return ["Filtered by steps: only %steps%", [
'%steps%' => implode(', ou ', $steps)
return ["Filtered by steps: only %step%", [
'%step%' => $this->translator->trans($step)
]];
}
@@ -72,7 +68,7 @@ class StepFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('acp.step', ':step');
$clause = $qb->expr()->eq('acp.step', ':step');
if ($where instanceof Andx) {
$where->add($clause);