/** * @inheritdoc */ public function run() { CommentFormAsset::register($this->getView()); $CommentCreateForm = new Comments\forms\CommentCreateForm(['Comment' => $this->Comment, 'entity' => $this->entity]); if ($CommentCreateForm->load(\Yii::$app->getRequest()->post())) { if ($CommentCreateForm->validate()) { if ($CommentCreateForm->save()) { \Yii::$app->getResponse()->refresh(sprintf($this->anchor, $CommentCreateForm->Comment->id))->send(); exit; } } } return $this->render('comment-form', ['CommentCreateForm' => $CommentCreateForm]); }
/** * Get default model classes */ protected function getDefaultModels() { return ['Comment' => Comments\models\Comment::className(), 'CommentQuery' => Comments\models\queries\CommentQuery::className(), 'CommentCreateForm' => Comments\forms\CommentCreateForm::className()]; }