Sulu\Bundle\MediaBundle\Controller\MediaController::deleteAction PHP Method

deleteAction() public method

Delete a media with the given id.
public deleteAction ( $id ) : Response
$id
return Symfony\Component\HttpFoundation\Response
    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);
    }