From 7183d9a3b1d835c8afd68d1bd252559e8e83aa66 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Oct 2024 16:46:48 +0200 Subject: [PATCH] Fix genderfilter to work with array of gender entity values --- .../Export/Filter/PersonFilters/GenderFilter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php index 9db093885..bc90eb035 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php @@ -39,7 +39,7 @@ class GenderFilter implements $where = $qb->getDQLPart('where'); $isIn = $qb->expr()->in('person.gender', ':person_gender'); - if (!\in_array('null', $data['accepted_genders'], true)) { + if (!\in_array('null', $data['accepted_genders']->toArray(), true)) { $clause = $isIn; } else { $clause = $qb->expr()->orX($isIn, $qb->expr()->isNull('person.gender')); @@ -53,7 +53,7 @@ class GenderFilter implements $qb->add('where', $where); $qb->setParameter('person_gender', \array_filter( - $data['accepted_genders'], + $data['accepted_genders']->toArray(), static fn ($el) => 'null' !== $el )); } @@ -108,7 +108,7 @@ class GenderFilter implements public function validateForm($data, ExecutionContextInterface $context) { - if (!\is_array($data['accepted_genders']) || 0 === \count($data['accepted_genders'])) { + if (!\is_iterable($data['accepted_genders']) || 0 === \count($data['accepted_genders'])) { $context->buildViolation('You should select an option') ->addViolation(); }