public function checkin() { $checkin = new \Club\CheckinBundle\Entity\Checkin(); $checkin->setUser($this->security_context->getToken()->getUser()); $this->em->persist($checkin); $this->em->flush(); $event = new \Club\CheckinBundle\Event\FilterCheckinEvent($checkin); $this->event_dispatcher->dispatch(\Club\CheckinBundle\Event\Events::onCheckinUser, $event); }
/** * @Route("/checkin/{user_id}") * @Template() */ public function checkinAction($user_id) { $em = $this->getDoctrine()->getManager(); $user = $em->find('ClubUserBundle:User', $user_id); $checkin = new \Club\CheckinBundle\Entity\Checkin(); $checkin->setUser($user); $em->persist($checkin); $em->flush(); $this->get('session')->getFlashBag()->add('notice', 'User has now checked in.'); return $this->redirect($this->generateUrl('club_checkin_admincheckin_index')); }