Ejemplo n.º 1
0
 public function createEventParticipation(EventParticipation $ep)
 {
     try {
         $eDb = $this->getEvent($ep->getEvent()->getId(), false);
         if ($eDb !== null) {
             $ep->setEvent($eDb);
             $this->ownerTypeHandle($ep);
             $this->participationDao->save($ep);
             $this->invalidateEntityCache($ep->getEvent());
             $this->onCreate($eDb);
         }
     } catch (DBALException $ex) {
         $this->logWarning($ex);
         throw new Exceptions\DuplicateEntryException("Event with this title already exist");
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Ejemplo n.º 2
0
 public function createEventParticipation($values)
 {
     try {
         $p = new EventParticipation((array) $values);
         $p->setEvent($this->getEntity());
         $p->setOwner($this->getUser()->getIdentity());
         $this->eventService->createEventParticipation($p);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave(null, "this", $ex);
     }
 }
Ejemplo n.º 3
0
 public function participationFormSuccess(EventParticipationForm $form)
 {
     $values = $form->getValues();
     switch ($form->getMode()) {
         case FormMode::UPDATE_MODE:
             foreach ($values->owners as $owner) {
                 $ep = new EventParticipation();
                 $ep->setOwner($owner);
                 $ep->setType($values->type);
                 $ep->setEvent($this->getEvent());
                 $ep->setContent($values->content);
                 try {
                     $this->eventService->createEventParticipation($ep);
                 } catch (Exceptions\DuplicateEntryException $ex) {
                     $this->presenter->flashMessage($this->presenter->tt("eventsModule.partForm.errorDupl", null, ["user" => $owner, "event" => $this->getEvent()->getId()]), \App\SystemModule\Presenters\BasePresenter::FM_ERROR);
                 } catch (Exceptions\DataErrorException $ex) {
                     $this->presenter->flashMessage($this->presenter->tt("eventsModule.partForm.errorSave", null, ["user" => $owner, "event" => $this->getEvent()->getId()]), \App\SystemModule\Presenters\BasePresenter::FM_ERROR);
                 }
             }
             break;
     }
     if (!$this->presenter->isAjax()) {
         $this->presenter->redirect("this");
     } else {
         // invalidate control
     }
 }