Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function buildReference(View $view, EntityManager $em)
 {
     $referenceId = ViewReferenceHelper::generateViewReferenceId($view);
     $viewReference = new ViewReference();
     $viewReference->setId($referenceId);
     $viewReference->setLocale($view->getCurrentLocale());
     $viewReference->setName($view->getName());
     $viewReference->setViewId($view->getId());
     $viewReference->setSlug($view->getSlug());
     $viewReference->setViewNamespace($em->getClassMetadata(get_class($view))->name);
     if ($parent = $view->getParent()) {
         $viewReference->setParent(ViewReferenceHelper::generateViewReferenceId($parent));
     }
     return $viewReference;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildReference(View $view, EntityManager $em)
 {
     /* @var Page $view */
     $referenceId = ViewReferenceHelper::generateViewReferenceId($view);
     $viewReference = new ViewReference();
     $viewReference->setId($referenceId);
     $viewReference->setLocale($view->getCurrentLocale());
     $viewReference->setName($view->getName());
     $viewReference->setViewId($view->getId());
     $viewReference->setSlug($view->isHomepage() ? '' : $view->getSlug());
     $viewReference->setViewNamespace(ClassUtils::getClass($view));
     if ($parent = $view->getParent()) {
         $parent->translate($view->getCurrentLocale());
         $viewReference->setParent(ViewReferenceHelper::generateViewReferenceId($parent));
     }
     return $viewReference;
 }