Can get all the response of a user to a survey into a SurveyResponse object

This commit is contained in:
Pierre
2018-05-13 19:16:10 +02:00
parent 8c2ba7fd31
commit 512f252c67
3 changed files with 102 additions and 0 deletions

View File

@ -131,4 +131,24 @@ class SurveysController {
}
/**
* Turn a SurveyResponse object into API array
*
* @param SurveyResponse $response The response to convert
* @return array Generated API entry
*/
public static function SurveyResponseToAPI(SurveyResponse $response) : array {
$data = array();
$data["id"] = $response->get_id();
$data["time_sent"] = $response->get_time_sent();
$data["userID"] = $response->get_userID();
$data["surveyID"] = $response->get_surveyID();
$data["choiceID"] = $response->get_choiceID();
return $data;
}
}