Пример #1
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
     }
 }