src/Flowcode/ShopBundle/Controller/AdminProductController.php
public function deleteGalleryItemAction(Request $request, GalleryItem $entity)
    {
        $form = $this->createDeleteForm($entity->getId());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find GalleryItem entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('admin_product'));
    }
public function deleteGalleryItemAction(Request $request, GalleryItem $entity)
    {
        $form = $this->createDeleteForm($entity->getId());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find GalleryItem entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('admin_product'));
    }
public function deleteGalleryItemAction ( Request $ request , GalleryItem $ entity ) { $ form = $ this -> createDeleteForm ( $ entity -> getId ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find GalleryItem entity.' ) ; } $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'admin_product' ) ) ; }
Deletes a GalleryItem entity.

@Route("/galleryitem/{id}", name="admin_product_gallery_delete")
@Method("DELETE")
Deletes a GalleryItem entity .