feat: filter destinations by common name
This commit is contained in:
@@ -4,7 +4,6 @@ namespace App\Repository;
|
||||
|
||||
use App\Entity\Application;
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\Teamer;
|
||||
use App\Model\AssignmentFilterDto;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
@@ -119,10 +118,10 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
|
||||
if ($hotelCodes = $filterDto->getHotels()) {
|
||||
foreach ($filterDto->getHotels() as $hotel) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->in('destination.hotelCode', ':hotelCodes'))
|
||||
->setParameter('hotelCodes', $hotelCodes)
|
||||
->andWhere($qb->expr()->like('destination.product', ':hotel'))
|
||||
->setParameter('hotel', '%'.$hotel.'%')
|
||||
;
|
||||
}
|
||||
|
||||
@@ -205,21 +204,6 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
return $assignment->getJobProfile();
|
||||
}, $result);
|
||||
|
||||
// Hotels
|
||||
$qb = $this->createQueryBuilder('assignment');
|
||||
$result = $qb
|
||||
->select('assignment', 'destination')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->groupBy('destination.hotelBusProId')
|
||||
->orderBy('destination.hotel', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
$options['hotels'] = array_map(function (Assignment $assignment) {
|
||||
return $assignment->getDestination();
|
||||
}, $result);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user