Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function afterDelete()
 {
     Tagging::deleteAll(['taggable_type' => Tagging::TAGGABLE_VIDEO, 'taggable_id' => $this->id]);
     Relation::deleteAll(['relationable_type' => Relation::RELATIONABLE_VIDEO, 'relationable_id' => $this->id]);
     Comment::deleteAll(['commentable_type' => Comment::COMMENTABLE_VIDEO, 'commentable_id' => $this->id]);
     CommentCount::deleteAll(['commentable_type' => CommentCount::COMMENTABLE_VIDEO, 'commentable_id' => $this->id]);
     $assets = Asset::find()->where(['assetable_type' => Asset::ASSETABLE_VIDEO, 'assetable_id' => $this->id])->orWhere(['assetable_type' => Asset::ASSETABLE_VIDEOFILE, 'assetable_id' => $this->id])->all();
     foreach ($assets as $asset) {
         $asset->delete();
     }
 }
Exemplo n.º 2
0
 public function actionDeletePost()
 {
     $selection = (array) Yii::$app->request->post('selection');
     foreach ($selection as $id) {
         Post::deleteAll(['id' => $id]);
         Like::deleteAll(['post_id' => $id]);
         Comment::deleteAll(['post_id' => $id]);
         PostTag::deleteAll(['post_id' => $id]);
         PostNotification::deleteAll(['post_id' => $id]);
         PostProtected::deleteAll(['post_id' => $id]);
     }
     return $this->render('post-manage');
 }
Exemplo n.º 3
0
 public function actionDelete()
 {
     if (Yii::$app->user->isGuest) {
         $this->redirect(Url::to(['/site/login']));
     }
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
         Post::findOne(['id' => $id])->delete();
         Like::deleteAll(['post_id' => $id]);
         Comment::deleteAll(['post_id' => $id]);
         PostTag::deleteAll(['post_id' => $id]);
         PostNotification::deleteAll(['post_id' => $id]);
         PostProtected::deleteAll(['post_id' => $id]);
     }
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function afterDelete()
 {
     Relation::deleteAll(['parent_id' => $this->id]);
     Comment::deleteAll(['commentable_type' => Comment::COMMENTABLE_MATCH, 'commentable_id' => $this->id]);
     CommentCount::deleteAll(['commentable_type' => CommentCount::COMMENTABLE_MATCH, 'commentable_id' => $this->id]);
 }
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function afterDelete()
 {
     Comment::deleteAll(['commentable_type' => Comment::COMMENTABLE_PHOTO, 'commentable_id' => $this->id]);
     CommentCount::deleteAll(['commentable_type' => CommentCount::COMMENTABLE_PHOTO, 'commentable_id' => $this->id]);
 }
Exemplo n.º 6
0
 public function afterDelete()
 {
     parent::afterDelete();
     Comment::deleteAll('post_id=' . $this->id);
     Tag::updateFrequency($this->tags, '');
 }
Exemplo n.º 7
0
 /**
  * Deletes an existing Post model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = $this->findModel($id);
     Comment::deleteAll(['post_id' => $id]);
     $model->unlinkAll('categories', true);
     $model->delete();
     return $this->redirect(['index']);
 }
Exemplo n.º 8
0
 /**
  * Deletes an existing User model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     Comment::deleteAll(['author_id' => $id]);
     $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }
Exemplo n.º 9
0
 /**
  * @inheritdoc
  */
 public function afterDelete()
 {
     $this->updateCacheBlocks();
     Tagging::deleteAll(['taggable_type' => Tagging::TAGGABLE_POST, 'taggable_id' => $this->id]);
     Relation::deleteAll(['relationable_type' => Relation::RELATIONABLE_POST, 'relationable_id' => $this->id]);
     Comment::deleteAll(['commentable_type' => Comment::COMMENTABLE_POST, 'commentable_id' => $this->id]);
     CommentCount::deleteAll(['commentable_type' => CommentCount::COMMENTABLE_POST, 'commentable_id' => $this->id]);
     SelectedBlog::deleteAll(['post_id' => $this->id]);
     $assets = Asset::find()->where(['assetable_type' => Asset::ASSETABLE_POST, 'assetable_id' => $this->id])->all();
     foreach ($assets as $asset) {
         $asset->delete();
     }
 }