GcContent\Controller\MediaController::removeAction PHP Method

removeAction() public method

Delete file
public removeAction ( ) : Zend\View\Model\JsonModel
return Zend\View\Model\JsonModel
    public function removeAction()
    {
        $property = Property\Model::fromId($this->getRouteMatch()->getParam('property_id'));
        $document = Document\Model::fromId($this->getRouteMatch()->getParam('document_id'));
        if ($this->getRequest()->getMethod() != 'DELETE' or empty($document) or empty($property)) {
            return $this->returnJson(array('error' => true));
        }
        $file = base64_decode($this->getRouteMatch()->getParam('file'));
        $fileClass = new File();
        $fileClass->load($property, $document);
        return $this->returnJson(array($fileClass->remove($file)));
    }