mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 01:53:49 +00:00
Pass class as second parameter to getReference() fixture method
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Chill\ThirdPartyBundle\DataFixtures\ORM;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\PostalCode;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
@@ -70,10 +71,10 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface
|
||||
$number = random_int(1, \count($references));
|
||||
|
||||
if (1 === $number) {
|
||||
yield $this->getReference($references[array_rand($references)], null);
|
||||
yield $this->getReference($references[array_rand($references)], Center::class);
|
||||
} else {
|
||||
foreach (array_rand($references, $number) as $index) {
|
||||
yield $this->getReference($references[$index], null);
|
||||
yield $this->getReference($references[$index], Center::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +83,7 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
$ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)];
|
||||
|
||||
return $this->getReference($ref, null);
|
||||
return $this->getReference($ref, PostalCode::class);
|
||||
}
|
||||
|
||||
private function getThirdParties(): ObjectSet
|
||||
|
Reference in New Issue
Block a user