From df3781a993dc1258b7959ef41e4df831a272807f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 26 Sep 2023 16:46:55 +0200 Subject: [PATCH] Regulation list: serach by exact postal code, and not the postal code's string content --- .changes/unreleased/Feature-20230926-164441.yaml | 7 +++++++ .../Repository/AccompanyingPeriodACLAwareRepository.php | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Feature-20230926-164441.yaml diff --git a/.changes/unreleased/Feature-20230926-164441.yaml b/.changes/unreleased/Feature-20230926-164441.yaml new file mode 100644 index 000000000..10ad686ec --- /dev/null +++ b/.changes/unreleased/Feature-20230926-164441.yaml @@ -0,0 +1,7 @@ +kind: Feature +body: "The regulation list load accompanying periods by exact postal code (address + associated with postal code), and not by the content of the postal code (postal + code with same code's string)" +time: 2023-09-26T16:44:41.414746336+02:00 +custom: + Issue: "155" diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index 79a7710ff..2e77096f2 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -79,11 +79,10 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin Join::WITH, 'COALESCE(IDENTITY(person_address.address), IDENTITY(location_history.addressLocation)) = address.id' ) - ->join('address.postcode', 'postcode') ->andWhere( - $qb->expr()->in('postcode.code', ':postal_codes') + $qb->expr()->in('address.postcode', ':postal_codes') ) - ->setParameter('postal_codes', array_map(fn (PostalCode $postalCode) => $postalCode->getCode(), $postalCodes)); + ->setParameter('postal_codes', $postalCodes); } return $qb;