Created
March 9, 2012 22:46
-
-
Save PhazeonPhoenix/2009117 to your computer and use it in GitHub Desktop.
Symfony: Doctrine Ordered Fixture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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