mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 13:06:13 +00:00
Fix genderfilter to work with array of gender entity values
This commit is contained in:
parent
70335a6360
commit
7183d9a3b1
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user