/**
  * @Security("has_role('ROLE_USER')")
  * @ParamConverter("emplacement", options={"mapping": {"emplacement_id" : "id"}}) 
  */
 public function deleteAction(Emplacement $emplacement)
 {
     if (!$this->getUser()->canDisplayExploitation($emplacement->getRucher()->getExploitation()) || !$emplacement->canBeDeleted()) {
         throw new NotFoundHttpException('Page inexistante.');
     }
     $em = $this->getDoctrine()->getManager();
     foreach ($emplacement->getTranshumancesfrom() as $transhumancefrom) {
         $transhumancefrom->setEmplacementFrom();
         $em->persist($transhumancefrom);
     }
     foreach ($emplacement->getTranshumancesto() as $transhumanceto) {
         $transhumanceto->setEmplacementTo();
         $em->persist($transhumanceto);
     }
     $em->remove($emplacement);
     $em->flush();
     $flash = $this->get('braincrafted_bootstrap.flash');
     $flash->success('Emplacement supprimé avec succès');
     return $this->redirect($this->generateUrl('kg_beekeeping_management_view_rucher', array('rucher_id' => $emplacement->getRucher()->getId())));
 }