mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix LoadHousehold fixture
This commit is contained in:
parent
5ee0ab5ab8
commit
744b62184a
@ -11,11 +11,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\PostalCode;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Household\MembersEditorFactory;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
@ -192,14 +194,20 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
|
||||
|
||||
private function preparePersonIds()
|
||||
{
|
||||
$centers = LoadCenters::$centers;
|
||||
|
||||
// @TODO: Remove this and make this service stateless
|
||||
$this->personIds = $this->em
|
||||
->createQuery(
|
||||
'SELECT p.id FROM ' . Person::class . ' p ' .
|
||||
'JOIN p.center c ' .
|
||||
'WHERE c.name = :center '
|
||||
'WHERE EXISTS( ' .
|
||||
'SELECT 1 FROM ' . PersonCenterHistory::class . ' pch ' .
|
||||
'JOIN pch.center c ' .
|
||||
'WHERE pch.person = p.id ' .
|
||||
'AND c.name IN (:authorized_centers)' .
|
||||
')'
|
||||
)
|
||||
->setParameter('center', 'Center A')
|
||||
->setParameter('authorized_centers', $centers)
|
||||
->getScalarResult();
|
||||
|
||||
shuffle($this->personIds);
|
||||
|
Loading…
x
Reference in New Issue
Block a user