diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index e3bb112..7992054 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -127,11 +127,15 @@ class AssignmentRepository extends ServiceEntityRepository ; } - foreach ($filterDto->getHotels() as $hotel) { - $qb - ->andWhere($qb->expr()->like('destination.hotel', ':hotel')) - ->setParameter('hotel', '%'.$hotel.'%') - ; + if (0 < count($filterDto->getHotels())) { + $constraints = []; + foreach ($filterDto->getHotels() as $index => $hotel) { + $constraints[] = $qb->expr()->like('destination.hotel', ':hotel'.$index); + } + $qb->andWhere($qb->expr()->orX(...$constraints)); + foreach ($filterDto->getHotels() as $index => $hotel) { + $qb->setParameter('hotel'.$index, '%'.$hotel.'%'); + } } if (null !== $duration = $filterDto->getDuration()) {