fix loading third party

This commit is contained in:
Julien Fastré 2021-10-08 17:56:13 +02:00
parent 0633fd812f
commit 72e9346b6b

View File

@ -21,13 +21,14 @@ class LoadThirdParty extends Fixture Implements DependentFixtureInterface
$thirdParties = $this->getThirdParties()->getObjects(); $thirdParties = $this->getThirdParties()->getObjects();
foreach ($thirdParties as $name => $thirdParty) { foreach ($thirdParties as $name => $thirdParty) {
if ('a' === $name[0]) { if ('a' === $name[0]) {
// this is an address // this is an address
continue; continue;
} }
$thirdParty->setCreatedAt(new \DateTimeImmutable('today'));
foreach ($this->getCenters() as $center) { foreach ($this->getCenters() as $center) {
$thirdParty->addCenter($center); $thirdParty->addCenter($center);
} }
$manager->persist($thirdParty); $manager->persist($thirdParty);
@ -38,7 +39,7 @@ class LoadThirdParty extends Fixture Implements DependentFixtureInterface
private function getCenters(): \Iterator private function getCenters(): \Iterator
{ {
$references = \array_map(function($a) { return $a['ref']; }, $references = \array_map(function($a) { return $a['ref']; },
LoadCenters::$centers); LoadCenters::$centers);
$number = random_int(1, count($references)); $number = random_int(1, count($references));