export: geographical unit filter

This commit is contained in:
nobohan 2022-08-29 16:22:36 +02:00
parent 81f04d0184
commit bf44b6b90d

View File

@ -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,
])
;