['get'], ]; } /** * @throws NotFoundHttpException */ public function actionGetAnswers(): array { $question_id = Yii::$app->request->get('question_id'); if(empty($question_id) or !is_numeric($question_id)) { throw new NotFoundHttpException('Incorrect questionnaire ID'); } $answers = Answer::activeAnswers($question_id); if(empty($answers)) { throw new NotFoundHttpException('Active questionnaire not found'); } array_walk( $answers, function(&$arr){ unset( $arr['created_at'], $arr['updated_at'], $arr['answer_flag'] ); }); return $answers; } }