fix: correctly filter by multiple hotels
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user