backend/controllers/MediaCommentController.php
/**
     * Reply an existing MediaComment model.
     * If reply is successful, the browser will be redirected to 'update' page.
     *
     * @param int $id Find MediaComment model based on id as its parent
     * @return string
     */
Reply an existing MediaComment model.
If reply is successful, the browser will be redirected to 'update' page.

@param int $id Find MediaComment model based on id as its parent
@return string
Reply an existing MediaComment model . If reply is successful the browser will be redirected to ' update ' page . @param int $id Find MediaComment model based on id as its parent @return string
public function actionReply($id)
    {
        $commentParent = $this->findModel($id);
        $model = new MediaComment(['scenario' => 'reply']);
        if ($model->load(Yii::$app->request->post())) {
            $model->setAttributes([
                'media_id' => $commentParent->media_id,
                'parent' => $commentParent->id,
            ]);
            if ($model->save()) {
                $this->redirect(['/media-comment/update', 'id' => $model->id]);
            }
        }
        return $this->render('reply', [
            'commentParent' => $commentParent,
            'model' => $model,
        ]);
    }
public function actionReply ( $ id ) { $ commentParent = $ this -> findModel ( $ id ) ; $ model = new MediaComment ( [ 'scenario' => 'reply' ] ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ model -> setAttributes ( [ 'media_id' => $ commentParent -> media_id , 'parent' => $ commentParent -> id , ] ) ; if ( $ model -> save ( ) ) { $ this -> redirect ( [ '/media-comment/update' , 'id' => $ model -> id ] ) ; } } return $ this -> render ( 'reply' , [ 'commentParent' => $ commentParent , 'model' => $ model , ] ) ; }
Reply an existing MediaComment model.
Reply an existing MediaComment model .