Exemple #1
0
 public function updateStaticPage(ArrayHash $values)
 {
     $page = new StaticPage();
     $page->fromArray((array) $values);
     $page->setEditor($this->getUser()->getIdentity());
     try {
         $this->staticPageService->updateStaticPage($page);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave($values->id, "this", $ex);
     }
     $this->redirect("default");
 }
 public function updateStaticPage(StaticPage $sp)
 {
     try {
         $dbPage = $this->pageDao->find($sp->getId());
         if ($dbPage !== null) {
             $dbPage->fromArray($sp->toArray());
             $dbPage->setUpdated(new DateTime());
             $this->sportGroupTypeHandle($dbPage);
             $this->handleAbbrConsistency($dbPage, true);
             $this->editorTypeHandle($dbPage);
             $this->entityManager->merge($dbPage);
             $this->entityManager->flush();
             $this->invalidateEntityCache($dbPage);
         }
         $this->onUpdate(clone $dbPage);
     } catch (DuplicateEntryException $ex) {
         $this->logWarning($ex->getMessage());
         throw new Exceptions\DuplicateEntryException($ex);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }