Use Person::centerHistory to load fixtures with given center

This commit is contained in:
2023-07-28 01:22:55 +02:00
parent 0e94e769cb
commit 6f2b538e27
5 changed files with 28 additions and 21 deletions

View File

@@ -82,8 +82,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
->findOneBy(['name' => 'Center A']);
$personIds = $em->createQuery('SELECT p.id FROM ' .
Person::class . ' p ' .
' WHERE p.center = :center')
Person::class . ' p JOIN p.centerCurrent cc' .
' WHERE cc.center = :center')
->setParameter('center', $center)
->setMaxResults(100)
->getScalarResult();
@@ -127,9 +127,10 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
->from(Person::class, 'p')
->join('p.accompanyingPeriodParticipations', 'participation')
->join('participation.accompanyingPeriod', 'ap')
->join('p.centerCurrent', 'cc')
->where(
$qb->expr()->eq(
'p.center',
'cc.center',
':center'
)
)
@@ -191,9 +192,10 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
->from(Person::class, 'p')
->join('p.accompanyingPeriodParticipations', 'participation')
->join('participation.accompanyingPeriod', 'ap')
->join('p.centerCurrent', 'cc')
->where(
$qb->expr()->eq(
'p.center',
'cc.center',
':center'
)
)
@@ -252,9 +254,10 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
->from(Person::class, 'p')
->join('p.accompanyingPeriodParticipations', 'participation')
->join('participation.accompanyingPeriod', 'ap')
->join('p.centerCurrent', 'cc')
->where(
$qb->expr()->eq(
'p.center',
'cc.center',
':center'
)
)