Ejemplo n.º 1
0
 /**
  * @Route("/bill/{id}/delete", name="sb_bill_delete", requirements={"id": "\d+"})
  */
 public function deleteAction(Request $request, $id)
 {
     $bill = $this->get('app.checker')->bill($this->getUser(), $id, false);
     $budget = $bill->getBudget();
     $action = Action::deleteBill($budget, $this->getUser(), $bill->toArray());
     $em = $this->getDoctrine()->getManager();
     $em->remove($bill);
     $em->persist($action);
     $em->flush();
     $this->addFlash('notice', $this->get('translator')->trans('bill.deletesuccessful'));
     return $this->redirectToRoute('sb_budget_show', array('id' => $budget->getId()));
 }