public function actionComment() { $frm = new Comments(); if ($frm->load(Yii::$app->request->post())) { //TODO: this is considered as given $frm->idtodo = 1; $frm->iduser = Yii::$app->user->id; if ($frm->save()) { echo "success"; } else { print_r($frm->getErrors()); } } }