/**
  *
  * @Route("/{id}/delete", requirements={"id" = "\d+"})
  * @Method({"GET"})
  */
 public function deleteAction($id)
 {
     // Check if branch doesn't have children :(
     $repo = $this->getRepository();
     $item = $this->getEntity($id);
     $children = $repo->children($item);
     if (count($children) == 0) {
         return parent::deleteAction($id);
     } else {
         $this->get('session')->getFlashBag()->add('warning', "Please remove all children of this node before you try to delete it.");
         $url = $this->createUrl('list_link');
         return $this->redirect($url);
     }
 }
 /**
  *
  * @Route("/{id}/delete", requirements={"id" = "\d+"})
  * @Method({"GET"})
  */
 public function deleteAction($id)
 {
     return parent::deleteAction($id);
 }