public function updateEvent(Event $e) { if ($e === NULL) { throw new Exceptions\NullPointerException("Argument Event was null"); } try { $this->entityManager->beginTransaction(); $eDb = $this->eventDao->find($e->getId()); if ($eDb !== null) { $eDb->fromArray($e->toArray()); $this->sportGroupsTypeHandle($eDb); $this->editorTypeHandle($eDb); $this->authorTypeHandle($eDb); $eDb->setUpdated(new DateTime()); $this->entityManager->merge($eDb); $this->entityManager->flush(); $this->invalidateEntityCache($eDb); $this->onUpdate($eDb); } $this->entityManager->commit(); } catch (DuplicateEntryException $ex) { $this->logWarning($ex); $this->entityManager->rollback(); throw new Exceptions\DuplicateEntryException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } catch (Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }