feat: timeline for role house manager
closes #869b9vmmx
This commit is contained in:
@@ -32,7 +32,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, Assignment::class);
|
||||
}
|
||||
|
||||
public function getListQuery(AssignmentFilterDto $filterDto, ?string $orderBy = null): Query
|
||||
public function getListQuery(AssignmentFilterDto $filterDto, ?string $orderBy = null, ?array $hotelCodes = null): Query
|
||||
{
|
||||
$qb = $this->createQueryBuilder('assignment');
|
||||
|
||||
@@ -56,6 +56,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
}
|
||||
|
||||
$this->applyFilterSettings($filterDto, $qb);
|
||||
$this->applyHotelCodeRestriction($qb, $hotelCodes);
|
||||
|
||||
return $qb->getQuery();
|
||||
}
|
||||
@@ -231,6 +232,27 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
private function applyHotelCodeRestriction(QueryBuilder $qb, ?array $hotelCodes = null): void
|
||||
{
|
||||
if (null === $hotelCodes) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([] === $hotelCodes) {
|
||||
$qb->andWhere('1 = 0');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$qb
|
||||
->andWhere($qb->expr()->orX(
|
||||
$qb->expr()->in($qb->expr()->substring('destination.hotelCode', 1, 3), ':hotelCodes'),
|
||||
$qb->expr()->in($qb->expr()->substring('destination.hotelCode', -3, 3), ':hotelCodes'),
|
||||
))
|
||||
->setParameter('hotelCodes', $hotelCodes)
|
||||
;
|
||||
}
|
||||
|
||||
public function getBookmarkQueryForTeamer(Teamer $teamer): Query
|
||||
{
|
||||
// Find ids of assignments with available slots first
|
||||
|
||||
Reference in New Issue
Block a user