private function createAjax() { $data = Yii::$app->request->post(); $model = new Review(['scenario' => Review::SCENARIO_CREATE]); foreach ($data['Review'] as $key => $value) { $model->{$key} = $value; } if ($model->validate()) { return $model->save() ? true : ErrorHelper::errorsToString($model->errors); } else { return ErrorHelper::errorsToString($model->errors); } }