Esempio n. 1
0
 /**
  * Deletes a Paquete entity.
  *
  * @Route("/{id}/delete", name="admin_paquete_list_delete")
  * @Method({"GET", "POST"})
  *
  * The Security annotation value is an expression (if it evaluates to false,
  * the authorization mechanism will prevent the user accessing this resource).
  * The isAuthor() method is defined in the AppBundle\Entity\Paquete entity.
  */
 public function listDeleteAction(Request $request, Paquete $paquete)
 {
     $entityManager = $this->getDoctrine()->getManager();
     if ($paquete->getImages()) {
         foreach ($paquete->getImages() as $image) {
             $image->removeUpload();
         }
     }
     $entityManager->remove($paquete);
     $entityManager->flush();
     $this->addFlash('success', 'paquete.deleted_successfully');
     return $this->redirectToRoute('admin_paquete_index');
 }