private function showTypedQuestionResults(Survey $survey, Question $question, $page = 1, $max = 20, $forExport = false)
 {
     $questionType = $question->getType();
     switch ($questionType) {
         case 'multiple_choice_single':
         case 'multiple_choice_multiple':
             return $this->showMultipleChoiceQuestionResults($survey, $question, $max, $forExport);
         case 'open_ended':
         case 'open_ended_bare':
             return $this->showOpenEndedQuestionResults($survey, $question, $page, $max, $forExport);
         case 'simple_text':
             return $this->showSimpleTextQuestionResults($survey, $question, $page, $max, $forExport);
         default:
             break;
     }
     return new Response();
 }
 public function createQuestionModel(Question $question)
 {
     $questionType = $question->getType();
     $model = new QuestionModel();
     $model->setTitle($question->getTitle());
     $model->setQuestionType($questionType);
     $model->setWorkspace($question->getWorkspace());
     $details = [];
     switch ($questionType) {
         case 'multiple_choice_single':
         case 'multiple_choice_multiple':
             $choiceQuestion = $this->getMultipleChoiceQuestionByQuestion($question);
             $details['questionType'] = $questionType;
             if ($question->isCommentAllowed()) {
                 $details['withComment'] = 'comment';
                 $details['commentLabel'] = $question->getCommentLabel();
             } else {
                 $details['withComment'] = 'no-comment';
             }
             $horizontal = !is_null($choiceQuestion) && $choiceQuestion->getHorizontal();
             $details['choiceDisplay'] = $horizontal ? 'horizontal' : 'vertical';
             $details['choices'] = [];
             if (!is_null($choiceQuestion)) {
                 $choices = $this->getChoicesByQuestion($question);
                 foreach ($choices as $choice) {
                     $choiceDetails = [];
                     $choiceDetails['other'] = $choice->isOther() ? 'other' : 'not-other';
                     $choiceDetails['content'] = $choice->getContent();
                     $details['choices'][] = $choiceDetails;
                 }
             }
             break;
         case 'open_ended':
         case 'open_ended_bare':
         case 'simple_text':
         default:
             break;
     }
     $model->setDetails($details);
     $this->om->persist($model);
     $this->om->flush();
 }