public function deleteAction(Request $request, $id)
    {
        $mediaManager = $this->get('opifer.media.media_manager');
        $media = $mediaManager->getRepository()->find($id);

        $dispatcher = $this->get('event_dispatcher');
        $event = new MediaResponseEvent($media, $request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_DELETE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $mediaManager->remove($media);

        return $this->redirectToRoute('opifer_media_media_index');
    }
public function deleteAction(Request $request, $id)
    {
        $mediaManager = $this->get('opifer.media.media_manager');
        $media = $mediaManager->getRepository()->find($id);

        $dispatcher = $this->get('event_dispatcher');
        $event = new MediaResponseEvent($media, $request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_DELETE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $mediaManager->remove($media);

        return $this->redirectToRoute('opifer_media_media_index');
    }
public function deleteAction ( Request $ request , $ id ) { $ mediaManager = $ this -> get ( 'opifer.media.media_manager' ) ; $ media = $ mediaManager -> getRepository ( ) -> find ( $ id ) ; $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ event = new MediaResponseEvent ( $ media , $ request ) ; $ dispatcher -> dispatch ( OpiferMediaEvents :: MEDIA_CONTROLLER_DELETE , $ event ) ; if ( null !== $ event -> getResponse ( ) ) { return $ event -> getResponse ( ) ; } $ mediaManager -> remove ( $ media ) ; return $ this -> redirectToRoute ( 'opifer_media_media_index' ) ; }
Deletes a media item.

@param Request $request
@param int     $id

@return \Symfony\Component\HttpFoundation\RedirectResponse
Deletes a media item .