/**
  * @param $label
  * @param $page
  * @param ObjectManager $manager
  * @return MenuNode
  */
 private function createMenuNodeForPage($label, $page, ObjectManager $manager)
 {
     $slugify = Slugify::create();
     $menuNode = new MenuNode();
     $menuNode->setName($slugify->slugify($label));
     $menuNode->setLabel($label);
     $menuNode->setContent($page);
     $menuNode->setParentDocument($manager->find(null, '/cms/menu/main'));
     return $menuNode;
 }
 /**
  * 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();
 }