Code Duplication    Length = 14-14 lines in 2 locations

backend/controllers/MediaCommentController.php 1 location

@@ 109-122 (lines=14) @@
106
     * @param integer $id
107
     * @return mixed
108
     */
109
    public function actionDelete($id)
110
    {
111
        $model = $this->findModel($id);
112
        $media = $model->commentMedia;
113
114
        if ($model->delete()) {
115
            if (!$model->parent) {
116
                $media->updateAttributes(['comment_count', --$media->comment_count]);
117
            }
118
            MediaComment::deleteAll(['parent' => $model->id]);
119
        }
120
121
        return $this->redirect(['index']);
122
    }
123
124
    /**
125
     * Bulk action for MediaComment triggered when button 'Apply' clicked.

backend/controllers/PostCommentController.php 1 location

@@ 116-129 (lines=14) @@
113
     * @param integer $id
114
     * @return mixed
115
     */
116
    public function actionDelete($id)
117
    {
118
        $model = $this->findModel($id);
119
        $post = $model->commentPost;
120
121
        if ($model->delete()) {
122
            if (!$model->parent) {
123
                $post->updateAttributes(['comment_count', --$post->comment_count]);
124
            }
125
            PostComment::deleteAll(['parent' => $model->id]);
126
        }
127
128
        return $this->redirect(['index', 'posttype' => $post->type]);
129
    }
130
131
    /**
132
     * Bulk action for PostComment triggered when button 'Apply' clicked.