src/Entity/Quiz.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuizRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassQuizRepository::class)]
  10. class Quiz
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $nom null;
  18.     #[ORM\OneToMany(mappedBy'quiz'targetEntityQuizQuestion::class, cascade: ['persist''remove'])]
  19.     private Collection $quizQuestions;
  20.     #[ORM\Column(length10000)]
  21.     private ?string $components null;
  22.     #[ORM\OneToMany(mappedBy'quiz'targetEntityPourcentageQuiz::class)]
  23.     private Collection $pourcentageQuizzes;
  24.     #[ORM\ManyToMany(targetEntityModule::class, inversedBy'quizzes')]
  25.     private Collection $module;
  26.     #[ORM\Column]
  27.     private ?bool $validated false;
  28.     #[ORM\OneToMany(mappedBy'quiz'targetEntityQuizResultat::class, orphanRemovaltrue)]
  29.     private Collection $quizResultats;
  30.     public function __construct()
  31.     {
  32.         $this->quizQuestions = new ArrayCollection();
  33.         $this->pourcentageQuizzes = new ArrayCollection();
  34.         $this->module = new ArrayCollection();
  35.         $this->quizResultats = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getNom(): ?string
  42.     {
  43.         return $this->nom;
  44.     }
  45.     public function setNom(string $nom): self
  46.     {
  47.         $this->nom $nom;
  48.         return $this;
  49.     }
  50.     /**
  51.      * @return Collection<int, QuizQuestion>
  52.      */
  53.     public function getQuizQuestions(): Collection
  54.     {
  55.         return $this->quizQuestions;
  56.     }
  57.     public function addQuizQuestion(QuizQuestion $quizQuestion): self
  58.     {
  59.         if (!$this->quizQuestions->contains($quizQuestion)) {
  60.             $this->quizQuestions->add($quizQuestion);
  61.             $quizQuestion->setQuiz($this);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeQuizQuestion(QuizQuestion $quizQuestion): self
  66.     {
  67.         if ($this->quizQuestions->removeElement($quizQuestion)) {
  68.             // set the owning side to null (unless already changed)
  69.             if ($quizQuestion->getQuiz() === $this) {
  70.                 $quizQuestion->setQuiz(null);
  71.             }
  72.         }
  73.         return $this;
  74.     }
  75.     public function getComponents(): ?string
  76.     {
  77.         return $this->components;
  78.     }
  79.     public function setComponents(string $components): self
  80.     {
  81.         $this->components $components;
  82.         return $this;
  83.     }
  84.     public function __toString()
  85.     {
  86.         return $this->nom;
  87.     }
  88.     /**
  89.      * @return Collection<int, PourcentageQuiz>
  90.      */
  91.     public function getPourcentageQuizzes(): Collection
  92.     {
  93.         return $this->pourcentageQuizzes;
  94.     }
  95.     public function addPourcentageQuiz(PourcentageQuiz $pourcentageQuiz): self
  96.     {
  97.         if (!$this->pourcentageQuizzes->contains($pourcentageQuiz)) {
  98.             $this->pourcentageQuizzes->add($pourcentageQuiz);
  99.             $pourcentageQuiz->setQuiz($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removePourcentageQuiz(PourcentageQuiz $pourcentageQuiz): self
  104.     {
  105.         if ($this->pourcentageQuizzes->removeElement($pourcentageQuiz)) {
  106.             // set the owning side to null (unless already changed)
  107.             if ($pourcentageQuiz->getQuiz() === $this) {
  108.                 $pourcentageQuiz->setQuiz(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, Module>
  115.      */
  116.     public function getModule(): Collection
  117.     {
  118.         return $this->module;
  119.     }
  120.     public function addModule(Module $module): self
  121.     {
  122.         if (!$this->module->contains($module)) {
  123.             $this->module->add($module);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeModule(Module $module): self
  128.     {
  129.         $this->module->removeElement($module);
  130.         return $this;
  131.     }
  132.     public function isValidated(): ?bool
  133.     {
  134.         return $this->validated;
  135.     }
  136.     public function setValidated(bool $validated): self
  137.     {
  138.         $this->validated $validated;
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection<int, QuizResultat>
  143.      */
  144.     public function getQuizResultats(): Collection
  145.     {
  146.         return $this->quizResultats;
  147.     }
  148.     public function addQuizResultat(QuizResultat $quizResultat): self
  149.     {
  150.         if (!$this->quizResultats->contains($quizResultat)) {
  151.             $this->quizResultats->add($quizResultat);
  152.             $quizResultat->setQuiz($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeQuizResultat(QuizResultat $quizResultat): self
  157.     {
  158.         if ($this->quizResultats->removeElement($quizResultat)) {
  159.             // set the owning side to null (unless already changed)
  160.             if ($quizResultat->getQuiz() === $this) {
  161.                 $quizResultat->setQuiz(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166. }