/**
  * @Route("/budget/new", name="sb_budget_new")
  */
 public function newAction(Request $request)
 {
     $budget = new Budget();
     $form = $this->createForm(BudgetType::class, $budget);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $budget->setUser($this->getUser());
         $invitation = new Invitation();
         $invitation->setBudget($budget);
         $invitation->setUser($budget->getUser());
         $invitation->setTarget($budget->getUser());
         $invitation->setStatus('manager');
         $action = Action::newBudget($budget, $this->getUser(), $budget->toArray());
         $em = $this->getDoctrine()->getManager();
         $em->persist($budget);
         $em->persist($invitation);
         $em->persist($action);
         $em->flush();
         $this->addFlash('notice', $this->get('translator')->trans('budget.createsuccessful'));
         return $this->redirectToRoute('sb_budgets');
     }
     return $this->render('budget/form.html.twig', array('form' => $form->createView()));
 }