From bf44b6b90decff0cb66aa08e850dc674d6dec0ed Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 29 Aug 2022 16:22:36 +0200 Subject: [PATCH] export: geographical unit filter --- .../GeographicalUnitStatFilter.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 8a18eb2fe..5445e20a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -2,13 +2,14 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +use Chill\MainBundle\Entity\GeographicalUnit; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -23,12 +24,6 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - - private const LOCTYPE = [ - 'center' => 'center', - // TODO not yet implemented: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/626 - ]; - /** * @inheritDoc */ @@ -38,9 +33,12 @@ class GeographicalUnitStatFilter implements FilterInterface ->add('date', ChillDateType::class, [ 'data' => new \DateTime(), ]) - ->add('accepted_loctype', ChoiceType::class, [ - 'choices' => self::LOCTYPE, - 'multiple' => false, + ->add('accepted_loctype', EntityType::class, [ + 'class' => GeographicalUnit::class, + 'choice_label' => function (GeographicalUnit $u) { + return $u->getUnitName(); + }, + 'multiple' => true, 'expanded' => true, ]) ;