From 3f2339bc607977478937b8179e27832631fcf1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 28 Aug 2023 15:58:54 +0200 Subject: [PATCH] Find person in center using centerCurrent in RelationshipApiControllerTest --- .../Controller/RelationshipApiControllerTest.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php index 7851c782d..4d45dc725 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php @@ -52,7 +52,8 @@ final class RelationshipApiControllerTest extends WebTestCase $countPersons = $em->createQueryBuilder() ->select('count(p)') ->from(Person::class, 'p') - ->join('p.center', 'c') + ->join('p.centerCurrent', 'center_current') + ->join('center_current.center', 'c') ->where('c.name LIKE :name') ->setParameter('name', 'Center A') ->getQuery() @@ -60,7 +61,8 @@ final class RelationshipApiControllerTest extends WebTestCase $person = $em->createQueryBuilder() ->select('p') ->from(Person::class, 'p') - ->join('p.center', 'c') + ->join('p.centerCurrent', 'center_current') + ->join('center_current.center', 'c') ->where('c.name LIKE :name') ->setParameter('name', 'Center A') ->getQuery() @@ -78,17 +80,20 @@ final class RelationshipApiControllerTest extends WebTestCase self::bootKernel(); $em = self::$container->get(EntityManagerInterface::class); $countPersons = $em->createQueryBuilder() - ->select('count(p)') + ->select('count(DISTINCT p)') ->from(Person::class, 'p') - ->join('p.center', 'c') + ->join('p.centerCurrent', 'center_current') + ->join('center_current.center', 'c') ->where('c.name LIKE :name') ->setParameter('name', 'Center A') ->getQuery() ->getSingleScalarResult(); + $persons = $em->createQueryBuilder() ->select('p') ->from(Person::class, 'p') - ->join('p.center', 'c') + ->join('p.centerCurrent', 'center_current') + ->join('center_current.center', 'c') ->where('c.name LIKE :name') ->setParameter('name', 'Center A') ->getQuery()