mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
datafixture relationship: attempt
This commit is contained in:
@@ -6,17 +6,31 @@ namespace Chill\PersonBundle\DataFixtures\ORM;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\PersonBundle\DataFixtures\ORM\LoadPeople;
|
||||
use Chill\PersonBundle\DataFixtures\ORM\LoadRelations;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
|
||||
class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function getDependencies()
|
||||
{
|
||||
return [
|
||||
LoadPeople::class,
|
||||
LoadRelations::class
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
|
||||
$relationship = new Relationship;
|
||||
$relationship->setFromPerson($this->getReference(LoadPeople::PERSON));
|
||||
$relationship->setToPerson($this->getReference(LoadPeople::PERSON));
|
||||
$relationship->setRelation($this->getReference(LoadRelations::RELATIONS));
|
||||
$relationship->setReverse((bool)random_int(0, 1));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user