public function ajouterAction(Request $request) { if ($request->isXmlHttpRequest()) { $nom = $request->request->get('nom'); $prenom = $request->request->get('prenom'); $numero = $request->request->get('numero'); $naissance = $request->request->get('naissance'); $idSection = $request->request->get('section'); $annee = $request->request->get('annee'); $section = $this->getDoctrine()->getRepository('AERGUSassociationBundle:Section')->find($idSection); $ressortissant = new Ressortissants(); $ressortissant->setNom($nom); $ressortissant->setPrenom($prenom); $ressortissant->setDateDeNaissance($naissance); $ressortissant->setNumeroDeTelephone($numero); $ressortissant->setAnneeVenu($annee); $ressortissant->setSection($section); $em = $this->getDoctrine()->getManager(); $em->persist($ressortissant); $em->flush(); $ressortissants = $this->getDoctrine()->getRepository('AERGUSassociationBundle:Ressortissants')->findBy(array('etat' => true)); return $this->render('AERGUSassociationBundle:AdminRessortissants:ajouter.html.twig', array('ressortissants' => $ressortissants)); } else { throw new \Exception("Erreur"); } }
/** * {@inheritDoc} */ public function getEtat() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEtat', array()); return parent::getEtat(); }