/** * @Secured(resource="showEvent") */ public function actionShowEvent($id) { $event = null; try { if (is_numeric($id)) { $event = $this->eventService->getEvent($id); } else { $event = $this->eventService->getEventAlias($id); } $this->setEntity($event); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($id, "default", $ex); } $parties = $event->getParticipations(); $uid = $this->getUser()->getIdentity()->getId(); $this->template->data = $event; $this->template->commentable = true; $bool = $parties->filter(function ($e) use($uid) { if ($e->getOwner()->getId() == $uid) { return true; } })->isEmpty(); $this->template->partyExist = $bool; $this->template->deadline = $event->getConfirmUntil() > new DateTime() ? true : false; }
/** * @Secured(resource="updateParticipation") */ public function actionUpdateParticipation($id) { try { $e = $this->eventsService->getEvent($id); if ($e !== null) { $this->setEntity($e); } $this->template->title = $e->getTitle(); $this->template->id = $e->getAlias(); } catch (Exceptions\EntityNotFoundException $ex) { $this->handleEntityNotExists($id, "this", $ex); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($id, "default", $ex); } }