mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-17 11:27:45 +00:00
Pass class as second parameter to getReference() fixture method
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\DataFixtures\ORM;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\DataFixtures\Helper\PersonRandomHelper;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
@@ -46,7 +47,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
->setFromPerson($this->getRandomPerson($this->em))
|
||||
->setToPerson($this->getRandomPerson($this->em))
|
||||
->setRelation($this->getReference(LoadRelations::RELATION_KEY.
|
||||
random_int(0, \count(LoadRelations::RELATIONS) - 1), null))
|
||||
random_int(0, \count(LoadRelations::RELATIONS) - 1), Relation::class))
|
||||
->setReverse((bool) random_int(0, 1))
|
||||
->setCreatedBy($user)
|
||||
->setUpdatedBy($user)
|
||||
@@ -74,6 +75,6 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
$userRef = array_rand(LoadUsers::$refs);
|
||||
|
||||
return $this->getReference($userRef, null);
|
||||
return $this->getReference($userRef, User::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user