| @@ 152-165 (lines=14) @@ | ||
| 149 | * @inheritdoc |
|
| 150 | * @throws \Exception |
|
| 151 | */ |
|
| 152 | public function afterDelete() |
|
| 153 | { |
|
| 154 | parent::afterDelete(); |
|
| 155 | $sameImages = static::findAll(['thumb_path' => $this->thumb_path]); |
|
| 156 | if (empty($sameImages) === true) { |
|
| 157 | if (Yii::$app->getModule('image')->fsComponent->has($this->thumb_path)) { |
|
| 158 | Yii::$app->getModule('image')->fsComponent->delete($this->thumb_path); |
|
| 159 | } |
|
| 160 | $thumbnailWatermarks = ThumbnailWatermark::findAll(['thumb_id' => $this->id]); |
|
| 161 | foreach ($thumbnailWatermarks as $thumbnailWatermark) { |
|
| 162 | $thumbnailWatermark->delete(); |
|
| 163 | } |
|
| 164 | } |
|
| 165 | } |
|
| 166 | } |
|
| 167 | ||
| @@ 264-277 (lines=14) @@ | ||
| 261 | return $this->file; |
|
| 262 | } |
|
| 263 | ||
| 264 | public function afterDelete() |
|
| 265 | { |
|
| 266 | parent::afterDelete(); |
|
| 267 | $sameImages = static::findAll(['filename' => $this->filename]); |
|
| 268 | if (empty($sameImages) === true) { |
|
| 269 | if (Yii::$app->getModule('image')->fsComponent->has($this->filename)) { |
|
| 270 | Yii::$app->getModule('image')->fsComponent->delete($this->filename); |
|
| 271 | } |
|
| 272 | } |
|
| 273 | $thumbnails = Thumbnail::findAll(['img_id' => $this->id]); |
|
| 274 | foreach ($thumbnails as $thumbnail) { |
|
| 275 | $thumbnail->delete(); |
|
| 276 | } |
|
| 277 | } |
|
| 278 | } |
|
| 279 | ||