Commit 00d18e6d authored by Shakarim Sapa's avatar Shakarim Sapa

- Настроили удаление файла из файловой системы перед удалением записи

parent c8b5de6a
......@@ -86,6 +86,20 @@ class AnalyticsSchoolCourse extends \common\components\ActiveRecordModel
return true;
}
/**
* @return bool
*/
public function beforeDelete(){
if (!parent::beforeDelete())
return false;
$filepath = Yii::getAlias('@frontend').$this->image;
if (file_exists($filepath)) {
unlink($filepath);
}
return true;
}
/**
* @param bool $insert
* @param array $changedAttributes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment