feat: filter assignments by hotel in favor of destination
This commit is contained in:
@@ -106,10 +106,10 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
|
||||
if (null !== $destination = $filterDto->getDestination()) {
|
||||
if (null !== $hotelCode = $filterDto->getHotel()) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->eq('assignment.destination', ':destination'))
|
||||
->setParameter('destination', $destination)
|
||||
->andWhere($qb->expr()->eq('destination.hotelCode', ':hotelCode'))
|
||||
->setParameter('hotelCode', $hotelCode)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -186,18 +186,18 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
return $assignment->getJobProfile();
|
||||
}, $result);
|
||||
|
||||
// Destinations
|
||||
// Hotels
|
||||
$qb = $this->createQueryBuilder('assignment');
|
||||
$result = $qb
|
||||
->select('assignment', 'destination')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->orderBy('destination.product', 'ASC')
|
||||
->groupBy('destination.id')
|
||||
->groupBy('destination.hotelBusProId')
|
||||
->orderBy('destination.hotel', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
$options['destinations'] = array_map(function (Assignment $assignment) {
|
||||
$options['hotels'] = array_map(function (Assignment $assignment) {
|
||||
return $assignment->getDestination();
|
||||
}, $result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user