Merge pull request #5036 from christianbeeznest/ofaj-21318

Exercise: Fix error doctrine in questions list and import ToolIcon - refs BT21318
pull/5037/head
christianbeeznest 2 years ago committed by GitHub
commit 1621b19da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      public/main/exercise/exercise.class.php
  2. 8
      src/CourseBundle/Entity/CQuiz.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;

@ -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

Loading…
Cancel
Save