/**
  * Manage urls.
  *
  * @param View $page
  *
  * @return void
  */
 protected function updateBusinessPageUrl(BusinessPage $page, EntityManager $em, UnitOfWork $uow)
 {
     $oldSlug = $page->getSlug();
     $staticUrl = $page->getStaticUrl();
     $computedPage = $this->businessPageBuilder->generateEntityPageFromTemplate($page->getTemplate(), $page->getBusinessEntity(), $em);
     $newSlug = $computedPage->getSlug();
     if ($staticUrl) {
         $staticUrl = preg_replace('/' . $oldSlug . '/', $newSlug, $staticUrl);
         $page->setStaticUrl($staticUrl);
     }
     $page->setSlug($newSlug);
     $meta = $em->getClassMetadata(get_class($page));
     $em->persist($page);
     $uow->computeChangeSet($meta, $page);
 }
 /**
  * Generate update the page parameters with the entity.
  *
  * @param BusinessPage $page
  * @param Entity       $entity
  */
 public function updatePageParametersByEntity(BusinessPage $page, $entity)
 {
     //if no entity is provided
     if ($entity === null) {
         //we look for the entity of the page
         if ($page->getBusinessEntity() !== null) {
             $entity = $page->getBusinessEntity();
         }
     }
     //only if we have an entity instance
     if ($entity !== null) {
         $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);
         if ($businessEntity !== null) {
             $businessProperties = $this->getBusinessProperties($businessEntity);
             //parse the business properties
             foreach ($businessProperties as $businessProperty) {
                 //parse of seo attributes
                 foreach ($this->pageParameters as $pageAttribute) {
                     $string = $this->getEntityAttributeValue($page, $pageAttribute);
                     $updatedString = $this->parameterConverter->setBusinessPropertyInstance($string, $businessProperty, $entity);
                     $this->setEntityAttributeValue($page, $pageAttribute, $updatedString);
                 }
             }
         }
     }
 }