public function deleteAction($id)
{
$delete = function ($id) {
try {
$collectionManager = $this->getCollectionManager();
$collectionManager->delete($id);
} catch (CollectionNotFoundException $cnf) {
throw new EntityNotFoundException(self::$entityName, $id);
// will throw 404 Entity not found
} catch (MediaException $me) {
throw new RestException($me->getMessage(), $me->getCode());
// will throw 400 Bad Request
}
};
$view = $this->responseDelete($id, $delete);
return $this->handleView($view);
}