Exemple #1
0
 public function afterDelete()
 {
     parent::afterDelete();
     $sameImages = static::findAll(['filename' => $this->filename]);
     if (empty($sameImages) === true) {
         if (Yii::$app->getModule('image')->fsComponent->has($this->filename)) {
             Yii::$app->getModule('image')->fsComponent->delete($this->filename);
         }
         $thumbnails = Thumbnail::findAll(['img_id' => $this->id]);
         foreach ($thumbnails as $thumbnail) {
             $thumbnail->delete();
         }
     }
 }
Exemple #2
0
 public function afterDelete()
 {
     parent::afterDelete();
     Yii::$app->getModule('image')->fsComponent->delete($this->filename);
     $thumbnails = Thumbnail::findAll(['img_id' => $this->id]);
     foreach ($thumbnails as $thumbnail) {
         $thumbnail->delete();
     }
 }