コード例 #1
0
ファイル: AdminPresenter.php プロジェクト: fuca/sportsclub
 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");
 }
コード例 #2
0
ファイル: StaticPageService.php プロジェクト: fuca/sportsclub
 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());
     }
 }