backend/controllers/MediaCommentController.php
/**
     * Deletes an existing MediaComment model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     *
     * @param integer $id
     * @return mixed
     */
Deletes an existing MediaComment model.
If deletion is successful, the browser will be redirected to the 'index' page.

@param integer $id
@return mixed
Deletes an existing MediaComment 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);
        $media = $model->commentMedia;
        if ($model->delete()) {
            if (!$model->parent) {
                $media->updateAttributes(['comment_count', --$media->comment_count]);
            }
            MediaComment::deleteAll(['parent' => $model->id]);
        }
        return $this->redirect(['index']);
    }
public function actionDelete ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ media = $ model -> commentMedia ; if ( $ model -> delete ( ) ) { if ( ! $ model -> parent ) { $ media -> updateAttributes ( [ 'comment_count' , -- $ media -> comment_count ] ) ; } MediaComment :: deleteAll ( [ 'parent' => $ model -> id ] ) ; } return $ this -> redirect ( [ 'index' ] ) ; }
Deletes an existing MediaComment model.
Deletes an existing MediaComment model .