Skip to content

Instantly share code, notes, and snippets.

@PhazeonPhoenix
Created March 9, 2012 22:46
Show Gist options
  • Save PhazeonPhoenix/2009117 to your computer and use it in GitHub Desktop.
Save PhazeonPhoenix/2009117 to your computer and use it in GitHub Desktop.
Symfony: Doctrine Ordered Fixture
<?php
namespace Acme\DemoBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Acme\DemoBundle\Entity\MyEntity;
class LoadMyEntityData extends AbstractFixture implements OrderedFixtureInterface
{
public function load(ObjectManager $manager)
{
$myEntity = new MyEntity();
$myEntity->setName("My Entity");
$manager->persist($myEntity);
$manager->flush();
}
public function getOrder()
{
return 10;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment