/** * Remove images after model deletion */ public function afterDelete() { // Remove children Photo models foreach ($this->photos as $photo) { $photo->delete(); } // Remove directory FileHelper::removeDirectory(Yii::getAlias('@webroot/images/' . $this->id)); parent::afterDelete(); }
public function afterDelete() { foreach ($this->books as $book) { $book->delete(); } parent::afterDelete(); }
public function afterDelete() { foreach ($this->articleMultArticles as $articleMultArticle) { $articleMultArticle->delete(); } parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); $xs_unicom = new \XS('unicom'); $xs_index = $xs_unicom->index; $xs_index->del($this->id); }
/** * */ public function afterDelete() { parent::afterDelete(); $auth = Yii::$app->authManager; $permission = $auth->getPermission($this->name); $auth->remove($permission); }
/** * Remove images and users after model deletion */ public function afterDelete() { foreach ($this->users as $user) { $user->delete(); } parent::afterDelete(); }
public function afterDelete() { foreach ($this->getAttachments() as $attach) { $attach->delete(); } return parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); if ($this->preview) { @unlink(Yii::getAlias('@webroot') . $this->preview); } }
public function afterDelete() { parent::afterDelete(); foreach ($this->getShopMedias()->all() as $media) { $media->delete(); } }
public function afterDelete() { foreach ($this->relLibraryBooks as $relLibraryBook) { $relLibraryBook->delete(); } parent::afterDelete(); }
/** * Delete file */ public function afterDelete() { $root = Yii::getAlias('@webroot'); if (file_exists($root . $this->path)) { unlink($root . $this->path); } parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); foreach ($this->history as $model) { $model->delete(); } return true; }
public function afterDelete() { $file = Yii::$app->params['uploadSalePath'] . DIRECTORY_SEPARATOR . $this->sale_id . DIRECTORY_SEPARATOR . $this->name; if (file_exists($file)) { unlink($file); } return parent::afterDelete(); }
public function afterDelete() { WarehouseEmail::deleteAll(['warehouse_id' => $this->id]); WarehousePhone::deleteAll(['warehouse_id' => $this->id]); WarehouseOpeninghours::deleteAll(['warehouse_id' => $this->id]); WarehouseProduct::deleteAll(['warehouse_id' => $this->id]); return parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); // Create history record $sql = "DELETE FROM `{$this->tableName()}` WHERE `ID` = {$this->attributes['ID']};"; $this->db->createCommand()->insert('History', ['User' => Yii::$app->user->identity->username, 'Command' => $sql])->execute(); return true; }
/** * @inheritdoc */ public function afterDelete() { SpecialPriceObject::deleteAllByObject($this); if (!static::find()->where(['order_id' => $this->order_id])->one()) { Order::deleteOrderElements($this->order); } parent::afterDelete(); }
public function afterDelete() { (new History(['user_id' => $this->user_id, 'action' => History::ACTION_DELETE_COMMENT, 'target' => $this->id]))->save(false); Siteinfo::updateCounterInfo('deleteComment'); UserInfo::updateCounterInfo('deleteComment', $this->user_id); Topic::afterCommentDelete($this->topic_id); return parent::afterDelete(); }
public function afterDelete() { foreach (SliderItem::find()->where('slider_id = :id', [':id' => $this->id])->all() as $item) { $item->delete(); } parent::afterDelete(); // TODO: Change the autogenerated stub }
public function afterDelete() { $serviceList = $this->getServices(); foreach ($serviceList as $service) { $service->delete(); } return parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); // TODO: Change the autogenerated stub foreach ($this->getTranslations()->all() as $translation) { $translation->delete(); } }
public function afterDelete() { parent::afterDelete(); Yii::$app->getModule('image')->fsComponent->delete($this->watermark_path); $thumbnailWatermarks = ThumbnailWatermark::findAll(['water_id' => $this->id]); foreach ($thumbnailWatermarks as $thumbnailWatermark) { $thumbnailWatermark->delete(); } }
public function afterDelete() { $type = 4; $client_name = $this->name; $logs = new Logs(); $logs->setAttributes(['date' => time(), 'type' => $type, 'client_name' => $client_name, 'user_id' => Yii::$app->user->identity->id]); $logs->save(false); parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); //删除所有权限 $auth = Yii::$app->authManager; if ($p = $auth->getPermission($this->route)) { $auth->remove($p); } }
public function afterDelete() { parent::afterDelete(); // TODO: Change the autogenerated stub $wall = new Wall(); $wall->setData(new SubscribeUser(['to' => $this->user_id, 'from' => $this->subscriber_id, 'status' => SubscribeUser::STATUS_UNSUBSCRIBE])); $wall->publishTo(new WallPost(['target_type' => WallPost::TARGET_TYPE_USER, 'target_id' => $this->user_id, 'personal' => true])); $wall->publishTo(new WallPost(['target_type' => WallPost::TARGET_TYPE_USER, 'target_id' => $this->subscriber_id, 'personal' => false])); $wall->save(); }
public function afterDelete() { parent::afterDelete(); if (!empty($this->name)) { $dir = $this->getPathImg() . DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR; $mack = $dir . $this->name . '*'; $mack = glob($mack); if (is_array($mack)) { array_map("unlink", $mack); } } }
public function afterDelete() { parent::afterDelete(); // TODO: Change the autogenerated stub $wall = new Wall(); $wall->setData(new SubscribeEvent(['userId' => $this->user_id, 'eventId' => $this->event_id, 'status' => SubscribeEvent::STATUS_UNSUBSCRIBE])); $wall->publishTo(new WallPost(['target_id' => $this->user_id, 'personal' => false])); foreach ($this->user->subscribers as $subscriber) { $wall->publishTo(new WallPost(['target_id' => $subscriber->id, 'personal' => true])); } $wall->save(false); }
/** * Remove image after model deletion */ public function afterDelete() { $basePath = Yii::getAlias('@webroot/images/' . $this->user_id); $imageFile = $basePath . '/' . $this->filename; $thumbFile = $basePath . '/thumbnail_' . $this->filename; if (file_exists($imageFile)) { unlink($imageFile); } if (file_exists($thumbFile)) { unlink($thumbFile); } parent::afterDelete(); }
public function afterDelete() { $file = $this->getPicFile(); @unlink($file); $files = FileHelper::findFiles(Yii::getAlias('@webroot') . DIRECTORY_SEPARATOR . self::PHOTO_PATH . DIRECTORY_SEPARATOR . self::THUMB_PATH, ['only' => [$this->pic_url . '*']]); foreach ($files as $file) { @unlink($file); } foreach ($this->articles as $article) { $article->delete(); } parent::afterDelete(); }
public function afterDelete() { $filePath = Yii::getAlias('@webroot') . $this->url; $splFile = new \SplFileInfo($filePath); $extension = pathinfo($splFile->getFilename(), PATHINFO_EXTENSION); if ($splFile->isFile()) { unlink($splFile->getRealPath()); // $originalFile = Yii::$app->params['dataDir'] . '/' . ltrim($this->url, '/'); // if (is_file($originalFile)) { // unlink($originalFile); // } } return parent::afterDelete(); }
public function afterDelete() { $file = Yii::$app->params['uploadSalePath'] . DIRECTORY_SEPARATOR . $this->sale_id . DIRECTORY_SEPARATOR . $this->id . '.jpg'; if (file_exists($file)) { unlink($file); } $file = Yii::getAlias('@frontend/web') . Yii::$app->params['salePhotoSlider']['path'] . $this->id . '.jpg'; if (file_exists($file)) { unlink($file); } $file = Yii::getAlias('@frontend/web') . Yii::$app->params['salePhotoBig']['path'] . $this->id . '.jpg'; if (file_exists($file)) { unlink($file); } $file = Yii::getAlias('@frontend/web') . Yii::$app->params['salePhotoSmall']['path'] . $this->id . '.jpg'; if (file_exists($file)) { unlink($file); } $file = Yii::getAlias('@frontend/web') . Yii::$app->params['salePhotoThumb']['path'] . $this->id . '.jpg'; if (file_exists($file)) { unlink($file); } return parent::afterDelete(); }