Ejemplo n.º 1
0
 /**
  * @return Registration
  */
 public function getCurrentRegistration()
 {
     $user = $this->getUser();
     $registration = $this->container->get('ritsiga.repository.registration')->findOneBy(['user' => $user]);
     if (!$registration) {
         $convention = $this->getCurrentSite();
         $registration = new Registration();
         $registration->setConvention($convention);
         $registration->setUser($user);
         $registration->setTaxdata(TaxData::copyFromUniversity($this->getUser()->getUniversity()));
     }
     return $registration;
 }
 /**
  * @Given /^que existen las inscripciones:$/
  */
 public function createStudentDelegation(TableNode $tableNode)
 {
     foreach ($tableNode->getHash() as $registrationHash) {
         $user = $this->getEntityManager()->getRepository('AppBundle:User')->findOneBy(['username' => $registrationHash['usuario']]);
         $convention = $this->getEntityManager()->getRepository('AppBundle:Convention')->findOneBy(['slug' => $registrationHash['asamblea']]);
         $registration = new Registration();
         $registration->setUser($user);
         $registration->setName($registrationHash['nombre']);
         $registration->setPosition($registrationHash['cargo']);
         $registration->setConvention($convention);
         $registration->setStatus($registrationHash['estado']);
         $this->getEntityManager()->persist($registration);
     }
     $this->getEntityManager()->flush();
 }
Ejemplo n.º 3
0
 public function forwardAction(ProcessContextInterface $context)
 {
     $request = $this->container->get('request_stack')->getCurrentRequest();
     $user = $this->get('security.token_storage')->getToken()->getUser();
     $siteManager = $this->container->get('ritsiga.site.manager');
     $convention = $siteManager->getCurrentSite();
     $em = $this->getDoctrine()->getManager();
     $registration = new Registration();
     $registration->setConvention($convention);
     $form = $this->createForm(new ResponsibleType(), $registration);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $registration->setUser($user);
         $em->persist($registration);
         $em->flush();
         $this->addFlash('warning', $this->get('translator')->trans('Your registration has been saved, you can now add registrations'));
         return $this->complete();
     }
 }