src/models/StorageFile.php
public function delete()
    {
        if ($this->beforeDelete()) {
            if (!Yii::$app->storage->fileSystemDeleteFile($this->name_new_compound)) {
                Logger::error("Unable to remove file from filesystem: " . $this->name_new_compound);
            }
            
            $this->updateAttributes(['is_deleted' => true]);
            
            $this->afterDelete();
            return true;
        }
    }
public function delete()
    {
        if ($this->beforeDelete()) {
            if (!Yii::$app->storage->fileSystemDeleteFile($this->name_new_compound)) {
                Logger::error("Unable to remove file from filesystem: " . $this->name_new_compound);
            }
            
            $this->updateAttributes(['is_deleted' => true]);
            
            $this->afterDelete();
            return true;
        }
    }
public function delete ( ) { if ( $ this -> beforeDelete ( ) ) { if ( ! Yii :: $ app -> storage -> fileSystemDeleteFile ( $ this -> name_new_compound ) ) { Logger :: error ( "Unable to remove file from filesystem: " . $ this -> name_new_compound ) ; } $ this -> updateAttributes ( [ 'is_deleted' => true ] ) ; $ this -> afterDelete ( ) ; return true ; } }
Delete a given file.

Override default implementation. Mark as deleted and remove files from file system.

Keep file in order to provide all file references.

@return boolean
Delete a given file .