src/Sulu/Bundle/MediaBundle/Controller/MediaController.php
public function deleteAction($id)
    {
        $delete = function($id) {
            try {
                $this->getMediaManager()->delete($id, true);
            } catch (MediaNotFoundException $e) {
                $entityName = $this->getParameter('sulu.model.media.class');

                throw new EntityNotFoundException($entityName, $id); // will throw 404 Entity not found
            } catch (MediaException $e) {
                throw new RestException($e->getMessage(), $e->getCode()); // will throw 400 Bad Request
            }
        };

        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
public function deleteAction($id)
    {
        $delete = function($id) {
            try {
                $this->getMediaManager()->delete($id, true);
            } catch (MediaNotFoundException $e) {
                $entityName = $this->getParameter('sulu.model.media.class');

                throw new EntityNotFoundException($entityName, $id); // will throw 404 Entity not found
            } catch (MediaException $e) {
                throw new RestException($e->getMessage(), $e->getCode()); // will throw 400 Bad Request
            }
        };

        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
public function deleteAction ( $ id ) { $ delete = function ( $ id ) { try { $ this -> getMediaManager ( ) -> delete ( $ id , true ) ; } catch ( MediaNotFoundException $ e ) { $ entityName = $ this -> getParameter ( 'sulu.model.media.class' ) ; throw new EntityNotFoundException ( $ entityName , $ id ) ; // will throw 404 Entity not found } catch ( MediaException $ e ) { throw new RestException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; // will throw 400 Bad Request } } ; $ view = $ this -> responseDelete ( $ id , $ delete ) ; return $ this -> handleView ( $ view ) ; }
Delete a media with the given id.

@param $id

@return \Symfony\Component\HttpFoundation\Response
Delete a media with the given id .