Skip to content

Instantly share code, notes, and snippets.

@mikeemoo
Created May 29, 2012 14:54
Show Gist options
  • Select an option

  • Save mikeemoo/2828875 to your computer and use it in GitHub Desktop.

Select an option

Save mikeemoo/2828875 to your computer and use it in GitHub Desktop.
LoadContentPageData
<?php
namespace Lowpress\ExampleBundle\DataFixtures\ORM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Lowpress\ExampleBundle\Entity\ContentPage;
class LoadContentPageData extends AbstractFixture implements OrderedFixtureInterface
{
public function load(ObjectManager $manager)
{
$contentpage = new ContentPage();
$contentpage->setPageTitle('My Content Page Title');
$contentpage->setUrl('my/content/page');
$contentpage->setMetaKeywords('my, content page, keywords');
$contentpage->setMetaDescription('my content page description');
$contentpage->setContent('content for page 1');
$contentpage->setSite($manager->merge($this->getReference('site-one')));
$manager->persist($contentpage);
$manager->flush();
}
public function getOrder()
{
return 3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment