Created
November 2, 2012 20:21
-
-
Save baldurrensch/4004098 to your computer and use it in GitHub Desktop.
Sample 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\Persistence\ObjectManager; | |
use Doctrine\Common\DataFixtures\AbstractFixture; | |
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | |
use Acme\DemoBundle\Entity\Product; | |
/** | |
*/ | |
class LoadProductData extends AbstractFixture implements OrderedFixtureInterface | |
{ | |
public function load(ObjectManager $manager) | |
{ | |
$product = new Product(); | |
$product->setName('Super Awesome Widget'); | |
$product->setShortName('widget'); | |
$product->setEnabled(true); | |
$manager->persist($product); | |
$manager->flush(); | |
} | |
public function getOrder() | |
{ | |
return 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment