/** * Get the Questions linked to a Paper. * * @param Paper $paper * * @return Question[] */ private function getPaperQuestions(Paper $paper) { $ids = explode(';', substr($paper->getOrdreQuestion(), 0, -1)); $questions = []; foreach ($ids as $id) { $question = $this->om->getRepository('UJMExoBundle:Question')->find($id); if ($question) { $questions[] = $question; } } return $questions; }