diff --git a/public/main/exercise/exercise.class.php b/public/main/exercise/exercise.class.php index 2a53ae8c7f..054b5c9f91 100644 --- a/public/main/exercise/exercise.class.php +++ b/public/main/exercise/exercise.class.php @@ -3,6 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Component\Utils\ChamiloApi; +use Chamilo\CoreBundle\Component\Utils\ToolIcon; use Chamilo\CoreBundle\Entity\GradebookLink; use Chamilo\CoreBundle\Entity\TrackEExercise; use Chamilo\CoreBundle\Entity\TrackEExerciseConfirmation; diff --git a/src/CourseBundle/Entity/CQuiz.php b/src/CourseBundle/Entity/CQuiz.php index 36e63e4fda..be538096c1 100644 --- a/src/CourseBundle/Entity/CQuiz.php +++ b/src/CourseBundle/Entity/CQuiz.php @@ -187,7 +187,9 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC */ public function getQuestions(): ArrayCollection { - return $this->questions; + return $this->questions instanceof ArrayCollection ? + $this->questions : + new ArrayCollection($this->questions->toArray()); } public function setTitle(string $title): self @@ -618,7 +620,9 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC */ public function getQuestionsCategories(): ArrayCollection { - return $this->questionsCategories; + return $this->questionsCategories instanceof ArrayCollection ? + $this->questionsCategories : + new ArrayCollection($this->questionsCategories->toArray()); } public function getResourceIdentifier(): int|Uuid