Exemplo n.º 1
0
 /**
  * Create an instance of the business entity page.
  *
  * @param BusinessTemplate $BusinessTemplate The business entity page
  * @param entity           $entity           The entity
  * @param string           $url              The new url
  *
  * @return \Victoire\Bundle\PageBundle\Entity\Page
  */
 public function createPageInstanceFromBusinessTemplate(BusinessTemplate $BusinessTemplate, $entity, $url)
 {
     //create a new page
     $newPage = new Page();
     $parentPage = $BusinessTemplate->getParent();
     //set the page parameter by the business entity page
     $newPage->setParent($parentPage);
     $newPage->setTemplate($BusinessTemplate);
     $newPage->setUrl($url);
     $newPage->setTitle($BusinessTemplate->getTitle());
     //update the parameters of the page
     $this->businessPageBuilder->updatePageParametersByEntity($newPage, $entity);
     $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);
     $entityProxy = new EntityProxy();
     $entityProxy->setEntity($entity, $businessEntity->getName());
     $newPage->setEntityProxy($entityProxy);
     return $newPage;
 }