[WIP] add fixtures for household address

This commit is contained in:
2021-06-15 22:52:48 +02:00
parent 35d35c9f40
commit 8bd20c9c78
3 changed files with 59 additions and 12 deletions

View File

@@ -88,17 +88,8 @@ class LoadThirdParty extends Fixture Implements DependentFixtureInterface
private function getPostalCode(): PostalCode
{
$ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)];
return $this->getReference($ref);
if (count($this->postalCodesIds) === 0) {
// fill the postal codes
$this->em->createQuery('SELECT p.id FROM '.PostalCode::class)
->getScalarResult();
}
$id = $this->postalCodesIds[\array_rand($this->postalCodesIds)];
return $this->em->getRepository(PostalCode::class)
->find($id);
}
private function createAddress(): ObjectSet