Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
36 rader
865 B
36 rader
865 B
<?php
|
|
|
|
namespace App\DataFixtures;
|
|
|
|
use App\Entity\Hero;
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
|
|
class HeroFixtures extends Fixture implements DependentFixtureInterface
|
|
{
|
|
public function load(ObjectManager $manager)
|
|
{
|
|
$hero = new Hero();
|
|
$hero->setName('ruffy');
|
|
$hero->setUser($this->getReference(UserFixtures::ADMIN_USER_REFERENCE));
|
|
|
|
$manager->persist($hero);
|
|
|
|
$hero = new Hero();
|
|
$hero->setName('goku');
|
|
$hero->setUser($this->getReference(UserFixtures::DUDE_USER_REFERENCE));
|
|
$manager->persist($hero);
|
|
|
|
$manager->flush();
|
|
}
|
|
|
|
public function getDependencies()
|
|
{
|
|
return array(
|
|
UserFixtures::class,
|
|
);
|
|
}
|
|
|
|
}
|