/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { if (!$manager instanceof DocumentManager) { $class = get_class($manager); throw new \RuntimeException("Fixtures requires PHPCR ODM DocumentManager instance, instance of '{$class}' given.'"); } $page = new Page(); $page->setTitle('To be edited'); $page->setText('This page has to be edited soon.'); $page->setPublishable(true); $manager->persist($page); $manager->flush(); }
/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $page = new Page(); $page->setTitle('Page 1'); $page->setText('Lorem ipsum dolor sit amet.'); $page->setPublishable(true); $page->addMenuNode($this->createMenuNodeForPage('Page 1', $page, $manager)); $manager->persist($page); $page = new Page(); $page->setTitle('Page 2'); $page->setText('Lorem ipsum dolor sit amet.'); $page->setPublishable(true); $page->addMenuNode($this->createMenuNodeForPage('Page 2', $page, $manager)); $manager->persist($page); $manager->flush(); }
/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $page = new Page(); $page->setTitle('Page 1'); $page->setText('Lorem ipsum dolor sit amet'); $page->setPublishable(true); $menuNode = new MenuNode(); $menuNode->setLabel('Page 1'); $menuNode->setParentDocument($manager->find(null, '/cms/menu/main')); $page->addMenuNode($menuNode); $manager->persist($page); $page = new Page(); $page->setTitle('Page 2'); $page->setText('Lorem ipsum dolor sit amet'); $page->setPublishable(true); $menuNode = new MenuNode(); $menuNode->setLabel('Page 2'); $menuNode->setParentDocument($manager->find(null, '/cms/menu/main')); $page->addMenuNode($menuNode); $manager->persist($page); $manager->flush(); }