Add second parameter to add-, get-, hasReference() methods in fixture classes

This commit is contained in:
2024-11-28 12:44:14 +01:00
parent 0ac49d1fde
commit 19e6ceba28
27 changed files with 61 additions and 59 deletions

View File

@@ -127,7 +127,7 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
foreach ($this->getRandomPersons(1, 3) as $person) {
$date = $startDate->add(new \DateInterval('P'.\random_int(1, 200).'W'));
$position = $this->getReference(LoadHouseholdPosition::ADULT);
$position = $this->getReference(LoadHouseholdPosition::ADULT, null);
$movement->addMovement($date, $person, $position, 0 === $k, 'self generated');
++$k;
@@ -136,7 +136,7 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
// load children
foreach ($this->getRandomPersons(0, 3) as $person) {
$date = $startDate->add(new \DateInterval('P'.\random_int(1, 200).'W'));
$position = $this->getReference(LoadHouseholdPosition::CHILD);
$position = $this->getReference(LoadHouseholdPosition::CHILD, null);
$movement->addMovement($date, $person, $position, 0 === $k, 'self generated');
++$k;
@@ -145,7 +145,7 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
// load children out
foreach ($this->getRandomPersons(0, 2) as $person) {
$date = $startDate->add(new \DateInterval('P'.\random_int(1, 200).'W'));
$position = $this->getReference(LoadHouseholdPosition::CHILD_OUT);
$position = $this->getReference(LoadHouseholdPosition::CHILD_OUT, null);
$movement->addMovement($date, $person, $position, 0 === $k, 'self generated');
++$k;
@@ -161,7 +161,7 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
{
$ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)];
return $this->getReference($ref);
return $this->getReference($ref, null);
}
private function getRandomPersons(int $min, int $max): array