public function load(ObjectManager $dm) { if (!$dm instanceof DocumentManager) { $class = get_class($dm); throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '{$class}' given."); } $parent = $dm->find(null, '/cms/pages'); $rootPage = new Page(); $rootPage->setTitle('main'); $rootPage->setParentDocument($parent); $dm->persist($rootPage); $page = new Page(); $page->setTitle('Home'); $page->setParentDocument($rootPage); $page->setContent(<<<HERE Welcome to the homepage of this really basic CMS. HERE ); $dm->persist($page); $page = new Page(); $page->setTitle('About'); $page->setParentDocument($rootPage); $page->setContent(<<<HERE This page explains what its all about. HERE ); $dm->persist($page); $dm->flush(); }
/** * {@inheritDoc} */ public function setTitle($title) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setTitle', array($title)); return parent::setTitle($title); }