Ejemplo n.º 1
0
 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());
     }
 }
Ejemplo n.º 2
0
 public function updateEvent(ArrayHash $values)
 {
     try {
         $e = new Event((array) $values);
         $e->setEditor($this->getUser()->getIdentity());
         $this->eventsService->updateEvent($e);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave(null, "this", $ex);
     }
     $this->redirect("default");
 }