Beispiel #1
0
 /**
  * Creates a new CommentRecord model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($type, $parent_id)
 {
     $model = new CommentRecord();
     // init parent_id attribute
     $model->parent_id = $parent_id;
     $model->type = $type;
     $model->setParentParams(['type' => $type, 'parent_id' => $parent_id]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }