Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save mikeemoo/2828871 to your computer and use it in GitHub Desktop.
LoadPageData
<?php
namespace Lowpress\CmsBundle\DataFixtures\ORM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Lowpress\CmsBundle\Entity\Path;
use Lowpress\CmsBundle\Entity\HtmlPage;
class LoadPageData extends AbstractFixture implements OrderedFixtureInterface
{
public function load(ObjectManager $manager)
{
$path = new Path();
$path->setUrl('my/page/url');
$path->setSite($manager->merge($this->getReference('site-one')));
$htmlpage = new HtmlPage();
$htmlpage->setPageTitle('My Html Page Title');
$htmlpage->setUrl('my/html/page');
$htmlpage->setMetaKeywords('my, html, keywords');
$htmlpage->setMetaDescription('my html description');
$htmlpage->setSite($manager->merge($this->getReference('site-one')));
$manager->persist($path);
$manager->persist($htmlpage);
$manager->flush();
}
public function getOrder()
{
return 2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment