Feat: Avoid adding of existing availabilities
This commit is contained in:
1 parent
3ae62ccee8
commit
392ea3f16f
2 files changed
+22
No files matched your search
@@ -78,4 +78,20 @@ class AvailabilityRepository extends ServiceEntityRepository
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function assertUnique(array $fields): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('availability');
|
||||
|
||||
return $qb
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->eq('availability.dateFrom', ':dateFrom'),
|
||||
$qb->expr()->eq('availability.dateTo', ':dateTo'),
|
||||
$qb->expr()->isNull('availability.owner')
|
||||
))
|
||||
->setParameters($fields)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user