public function addAction($exercice_id)
 {
     $em = $this->get('doctrine.orm.entity_manager');
     $exercice = $em->getRepository('TrezLogicielTrezBundle:Exercice')->find($exercice_id);
     $budget = new Budget();
     $budget->setExercice($exercice);
     $form = $this->get('form.factory')->create(new BudgetType(), $budget);
     if ('POST' === $this->get('request')->getMethod()) {
         $form->handleRequest($this->get('request'));
         if ($form->isValid()) {
             $em->persist($budget);
             $em->flush();
             $this->get('session')->getFlashBag()->set('success', "Le budget a bien été ajouté");
             return new RedirectResponse($this->generateUrl('budget_index', array('exercice_id' => $exercice_id)));
         }
     }
     $this->get('trez.logiciel_trez.breadcrumbs')->setBreadcrumbs($exercice, 'Ajouter un budget ');
     return $this->render('TrezLogicielTrezBundle:Budget:add.html.twig', array('form' => $form->createView(), 'exercice_id' => $exercice_id));
 }
 protected function setBudget(Budget $entity)
 {
     $this->tempBreadcrumbs[] = new BreadcrumbsItem('Catégories de ' . $entity->getNom(), $this->router->generate('categorie_index', array('budget_id' => $entity->getId())));
     $this->setExercice($entity->getExercice());
 }
 public function duplicate()
 {
     $n_budget = new Budget();
     $n_budget->setNom('Copie de ' . $this->nom)->setExercice($this->exercice)->setVerrouille(false);
     // verrouille has to be false
     return $n_budget;
 }