Exemplo n.º 1
0
 /**
  * @return \WellCommerce\AppBundle\Entity\PageInterface
  */
 public function create()
 {
     $page = new Page();
     $page->setHierarchy(0);
     $page->setCreatedAt(new \DateTime());
     $page->setClientGroups(new ArrayCollection());
     $page->setShops(new ArrayCollection());
     $page->setParent(null);
     $page->setPublish(true);
     $page->setRedirectType(1);
     return $page;
 }
Exemplo n.º 2
0
 /**
  * Creates a cms page
  *
  * @param string $name
  * @param int    $hierarchy
  * @param Page   $parent
  *
  * @return Page
  */
 protected function createPage($name, $hierarchy, Page $parent = null)
 {
     $page = new Page();
     $page->setParent($parent);
     $page->setHierarchy($hierarchy);
     $page->setPublish(1);
     $page->setRedirectType(0);
     $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;
 }