feat: overview of teamers' custom availabilities
This commit is contained in:
@@ -23,20 +23,28 @@ class AvailabilityRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, Availability::class);
|
||||
}
|
||||
|
||||
public function getListQuery(): Query
|
||||
public function getListQuery(bool $custom = false): Query
|
||||
{
|
||||
$qb = $this->createQueryBuilder('availability');
|
||||
|
||||
return $qb
|
||||
$qb
|
||||
->select('availability', 'teamer')
|
||||
->leftJoin('availability.owner', 'teamer')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->gt('availability.dateFrom', ':today'),
|
||||
$qb->expr()->isNull('availability.owner'),
|
||||
$qb->expr()->isNull('availability.deletedAt')
|
||||
))
|
||||
->orderBy('availability.dateFrom', 'ASC')
|
||||
->setParameter('today', new \DateTimeImmutable())
|
||||
->getQuery()
|
||||
;
|
||||
|
||||
if (false === $custom) {
|
||||
$qb->andWhere($qb->expr()->isNull('availability.owner'));
|
||||
} else {
|
||||
$qb->andWhere($qb->expr()->isNotNull('availability.owner'));
|
||||
}
|
||||
|
||||
return $qb->getQuery();
|
||||
}
|
||||
|
||||
public function getSelectableForTeamer(Teamer $teamer): array
|
||||
|
||||
Reference in New Issue
Block a user