/** * @Security("has_role('ROLE_USER')") * @ParamConverter("colonie", options={"mapping": {"colonie_id" : "id"}}) */ public function deleteAction(Colonie $colonie) { if (!$this->getUser()->canDisplayExploitation($colonie->getRuche()->getRucher()->getExploitation()) || !$colonie->canBeDeleted()) { throw new NotFoundHttpException('Page inexistante.'); } $em = $this->getDoctrine()->getManager(); $em->remove($colonie); $em->flush(); $flash = $this->get('braincrafted_bootstrap.flash'); $flash->success('Ruche supprimée avec succès'); return $this->redirect($this->generateUrl('kg_beekeeping_management_view_rucher', array('rucher_id' => $colonie->getRuche()->getRucher()->getId()))); }