checkComment($id); $user = $this->getLoginUser(); $validator = new CommentValidator(); $validator->checkOwner($user->id, $comment->owner_id); $comment->deleted = 1; $comment->update(); if ($comment->item_type == CommentModel::ITEM_ARTICLE) { $article = $this->checkArticle($comment->item_id); $this->decrArticleCommentCount($article); } } protected function decrArticleCommentCount(ArticleModel $article) { if ($article->comment_count > 0) { $article->comment_count -= 1; $article->update(); } } }