residential address: filter by person in the repository

This commit is contained in:
nobohan 2022-03-01 14:36:22 +01:00
parent a7240e8cc6
commit 48a32f2403

View File

@ -50,6 +50,8 @@ class ResidentialAddressRepository extends ServiceEntityRepository
$date = null === $at ? new DateTimeImmutable('today') : $at;
$qb = $this->createQueryBuilder('ra');
$dateFilter = $qb->expr()->andX(
$qb->expr()->lte('ra.startDate', ':dateIn'),
$qb->expr()->orX(
@ -60,7 +62,9 @@ class ResidentialAddressRepository extends ServiceEntityRepository
$qb
->where($dateFilter)
->setParameter('dateIn', $date, Types::DATE_IMMUTABLE);
->setParameter('dateIn', $date, Types::DATE_IMMUTABLE)
->andWhere('ra.person = :person')
->setParameter('person', $person);
return $qb;
}