Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (24 sloc) 0.893 kB
<?php
namespace Doctrine\Tests\Common\DataFixtures\TestFixtures;
use Doctrine\Common\DataFixtures\SharedFixtureInterface;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Tests\Common\DataFixtures\TestEntity\Role;
class RoleFixture implements SharedFixtureInterface
{
private $referenceRepository;
public function setReferenceRepository(ReferenceRepository $referenceRepository)
{
$this->referenceRepository = $referenceRepository;
}
public function load($manager)
{
$adminRole = new Role();
$adminRole->setName('admin');
$anonymousRole = new Role;
$anonymousRole->setName('anonymous');
$manager->persist($adminRole);
$manager->persist($anonymousRole);
$manager->flush();
$this->referenceRepository->addReference('admin-role', $adminRole);
}
}
Jump to Line
Something went wrong with that request. Please try again.