['post'], 'set-responses' => ['post'], ]; } /** * @throws InvalidConfigException * @throws ServerErrorHttpException|BadRequestHttpException */ public function actionSetResponse(): UserResponse { $userResponseModel = UserResponseService::createUserResponse(Yii::$app->getRequest()->getBodyParams()); if ($userResponseModel->errors) { throw new ServerErrorHttpException(json_encode($userResponseModel->errors)); } return $userResponseModel; } /** * @throws InvalidConfigException * @throws ServerErrorHttpException|BadRequestHttpException */ public function actionSetResponses(): array { $userResponseModels = UserResponseService::createUserResponses(Yii::$app->getRequest()->getBodyParams()); foreach ($userResponseModels as $model) { if ($model->errors) { throw new ServerErrorHttpException(json_encode($model->errors)); } } return $userResponseModels; } }