CRUDlex\AbstractData::deleteFile PHP Method

deleteFile() public method

Deletes a specific file from an existing entity.
public deleteFile ( Entity $entity, string $entityName, string $field ) : boolean
$entity Entity the entity to delete the file from
$entityName string the name of the entity as this class here is not aware of it
$field string the field of the entity containing the file to be deleted
return boolean true on successful deletion
    public function deleteFile(Entity $entity, $entityName, $field)
    {
        $result = $this->shouldExecuteEvents($entity, 'before', 'deleteFile');
        if (!$result) {
            return false;
        }
        $this->fileProcessor->deleteFile($entity, $entityName, $field);
        $this->shouldExecuteEvents($entity, 'after', 'deleteFile');
        return true;
    }