/**
  * Creates pages and their corresponding routes & menu entries
  * @param  ObjectManager $this->documentManager PHPCR ODM DocumentManager instance
  */
 private function createLondaPages()
 {
     //the menus
     $mainMenu = $this->createMenus();
     $pages = Yaml::parse(file_get_contents(__DIR__ . '/../../Resources/data/pages.yml'));
     //Create the pages and their corresponding routes and menu nodes
     foreach ($pages["KanzuCode\\LondaBundle\\Document\\Page"] as $pageId => $page) {
         //Define the route
         $route = new Route();
         $route->setParentDocument($this->documentManager->find(null, $this->config['parameters']['londa.basepath.routes']));
         $route->setName($page['route']);
         if (isset($page['template'])) {
             $route->setDefault('_template', "KanzuCodeLondaBundle:Default:{$page['template']}.html.twig");
         }
         if (isset($page['controller'])) {
             $route->setDefault('_controller', "KanzuCodeLondaBundle:LondaContent:{$page['controller']}");
         }
         $this->documentManager->persist($route);
         // add the route
         //Add menu node
         $menuNode = new MenuNode();
         $menuNode->setName($pageId);
         $menuNode->setLabel($page['title']);
         $menuNode->setParentDocument($mainMenu);
         $this->documentManager->persist($menuNode);
         //Do the content
         $content = new Page();
         $content->setParentDocument($this->documentManager->find(null, $this->config['parameters']['londa.basepath.pages']));
         $content->setName($pageId);
         $content->setTitle($page['title']);
         $content->setBody($page['body']);
         $content->addRoute($route);
         $content->addMenuNode($menuNode);
         $this->documentManager->persist($content);
     }
 }
 /**
  * Create a page
  * @param string $pageName
  * @param string $pageTitle
  * @param string $pageBody
  * @param Route $route
  */
 private function createPage($pageName, $pageTitle, $pageBody, $route)
 {
     $content = new Page();
     $content->setParentDocument($this->documentManager->find(null, $this->config['parameters']['londa.basepath.pages']));
     $content->setName($pageName);
     $content->setTitle($pageTitle);
     $content->setBody($pageBody);
     $content->addRoute($route);
     return $content;
 }