From 2c83b4c912eb5e9fe23dd5804048be1d2863e4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 28 Aug 2023 13:43:44 +0200 Subject: [PATCH] Fix HouseholdACLAwareRepository: use the correct association to person's center --- .../Repository/Household/HouseholdACLAwareRepository.php | 3 ++- .../Tests/Controller/HouseholdApiControllerTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php index 7cc9e7dbe..c0034eea0 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php @@ -41,8 +41,9 @@ final readonly class HouseholdACLAwareRepository implements HouseholdACLAwareRep $qb ->join($alias . '.members', 'members') ->join('members.person', 'person') + ->join('person.centerCurrent', 'person_center_current') ->andWhere( - $qb->expr()->in('person.center', ':centers') + $qb->expr()->in('person_center_current.center', ':centers') ) ->setParameter('centers', $centers); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php index 10a571728..365904f0d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -76,7 +76,8 @@ final class HouseholdApiControllerTest extends WebTestCase $em->persist($p); $h = new Household(); $h->addMember($m = (new HouseholdMember())->setPerson($p)); - $h->addAddress(Address::createFromAddressReference($reference)->setValidFrom(new DateTime('today'))); + $h->addAddress($a = Address::createFromAddressReference($reference)->setValidFrom(new DateTime('today'))); + $em->persist($a); $em->persist($m); $em->persist($h);