This commit is contained in:
2022-01-23 23:22:04 +01:00
parent 7e2fbf93f9
commit eccc75aecf
5 changed files with 65 additions and 55 deletions

View File

@@ -29,28 +29,6 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
}
private function buildQueryNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until): QueryBuilder
{
$qb = $this->repository->createQueryBuilder('w');
$qb
->join('w.accompanyingPeriod', 'period')
->where(
$qb->expr()->andX(
$qb->expr()->eq('period.user', ':user'),
$qb->expr()->gte('w.endDate', ':since'),
$qb->expr()->lte('w.startDate', ':until')
)
)
->setParameters([
'user' => $user,
'since' => $since,
'until' => $until,
]);
return $qb;
}
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
{
return $this->repository->countByAccompanyingPeriod($period);
@@ -152,4 +130,26 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
return $qb;
}
private function buildQueryNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until): QueryBuilder
{
$qb = $this->repository->createQueryBuilder('w');
$qb
->join('w.accompanyingPeriod', 'period')
->where(
$qb->expr()->andX(
$qb->expr()->eq('period.user', ':user'),
$qb->expr()->gte('w.endDate', ':since'),
$qb->expr()->lte('w.startDate', ':until')
)
)
->setParameters([
'user' => $user,
'since' => $since,
'until' => $until,
]);
return $qb;
}
}