Skip to content

Instantly share code, notes, and snippets.

@baldurrensch
Created November 2, 2012 20:21
Show Gist options
  • Save baldurrensch/4004098 to your computer and use it in GitHub Desktop.
Save baldurrensch/4004098 to your computer and use it in GitHub Desktop.
Sample Fixture
<?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