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()); } }