Example #1
0
 public function create() : PageInterface
 {
     $page = new Page();
     $page->setHierarchy(0);
     $page->setCreatedAt(new \DateTime());
     $page->setClientGroups($this->createEmptyCollection());
     $page->setShops($this->createEmptyCollection());
     $page->setParent(null);
     $page->setPublish(true);
     $page->setRedirectType(1);
     $page->setSection('');
     return $page;
 }
Example #2
0
 /**
  * Creates a cms page
  *
  * @param string        $name
  * @param int           $hierarchy
  * @param PageInterface $parent
  *
  * @return PageInterface
  */
 protected function createPage($name, $hierarchy, PageInterface $parent = null)
 {
     $page = new Page();
     $page->setParent($parent);
     $page->setHierarchy($hierarchy);
     $page->setPublish(1);
     $page->setRedirectType(0);
     $page->setSection('');
     $page->addShop($this->shop);
     $page->translate('en')->setName($name);
     $page->translate('en')->setSlug(Sluggable::makeSlug($name));
     $page->translate('en')->setContent($this->defaultText);
     $page->mergeNewTranslations();
     $this->manager->persist($page);
     return $page;
 }