public function ajouterBureauAction(Request $request) { if ($request->isXmlHttpRequest()) { $nom = $request->request->get('nom'); $id = $request->request->get('id'); $bureau = new Bureau(); $programme = $this->getDoctrine()->getRepository('AERGUSassociationBundle:Programme')->find($id); $bureau->setNom($nom); $bureau->setProgramme($programme); $em = $this->getDoctrine()->getManager(); $em->persist($bureau); $em->flush(); $bureaux = $this->getDoctrine()->getRepository('AERGUSassociationBundle:Bureau')->findAll(); $paths = array(); $id = 0; foreach ($bureaux as $bureau) { $path = array(); $tab = array(); $path = explode('/', $bureau->getProgramme()->getPath()); $namePath = $path[sizeof($path) - 1]; $tab['id'] = $bureau->getId(); $tab['nomPath'] = $namePath; $tab['nomBureau'] = $bureau->getNom(); $paths[$id] = $tab; $id++; } return $this->render('AERGUSassociationBundle:AdminBureau:ajouterBureau.html.twig', array('bureaux' => $paths)); } else { throw new \Exception("Erreur"); } }
/** * {@inheritDoc} */ public function getProjets() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getProjets', array()); return parent::getProjets(); }