public function validateAttend(\Club\EventBundle\Entity\Event $event, \Club\UserBundle\Entity\User $user) { if (!$event->isOpen()) { throw new \Club\EventBundle\Exception\AttendNotAvailableException($this->trans->trans('Subscription to event is not open')); } $this->attend = new \Club\EventBundle\Entity\Attend(); $this->attend->setUser($user); $this->attend->setEvent($event); $errors = $this->validator->validate($this->attend); if (count($errors) > 0) { foreach ($errors as $error) { throw new EventException($error->getMessage()); } } }
/** * @Route("/signin/{id}", name="event_event_signin") * @Template() */ public function signinAction(\Club\EventBundle\Entity\Event $event) { $this->get('session')->set('_security.user.target_path', $this->generateUrl('event_event_attend', array('id' => $event->getId()), true)); return $this->redirect($this->generateUrl('club_user_auth_signin')); }