src/Entity/QuizQuestion.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuizQuestionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassQuizQuestionRepository::class)]
  8. class QuizQuestion
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length100000)]
  15.     private ?string $label null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $type null;
  18.     #[ORM\OneToMany(mappedBy'question'targetEntityQuizReponse::class, cascade: ['persist''remove'])]
  19.     private Collection $quizReponses;
  20.     #[ORM\ManyToOne(inversedBy'quizQuestions')]
  21.     private ?Quiz $quiz null;
  22.     #[ORM\OneToMany(mappedBy'quizQuestion'targetEntityQuestionOptions::class, cascade: ['persist''remove'])]
  23.     private Collection $options;
  24.     #[ORM\Column(length255)]
  25.     private ?string $IdFileds null;
  26.     public function __construct()
  27.     {
  28.         $this->quizReponses = new ArrayCollection();
  29.         $this->options = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getLabel(): ?string
  36.     {
  37.         return $this->label;
  38.     }
  39.     public function setLabel(string $label): self
  40.     {
  41.         $this->label $label;
  42.         return $this;
  43.     }
  44.     public function getType(): ?string
  45.     {
  46.         return $this->type;
  47.     }
  48.     public function setType(string $type): self
  49.     {
  50.         $this->type $type;
  51.         return $this;
  52.     }
  53.     /**
  54.      * @return Collection<int, QuizReponse>
  55.      */
  56.     public function getQuizReponses(): Collection
  57.     {
  58.         return $this->quizReponses;
  59.     }
  60.     public function addQuizReponse(QuizReponse $quizReponse): self
  61.     {
  62.         if (!$this->quizReponses->contains($quizReponse)) {
  63.             $this->quizReponses->add($quizReponse);
  64.             $quizReponse->setQuestion($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeQuizReponse(QuizReponse $quizReponse): self
  69.     {
  70.         if ($this->quizReponses->removeElement($quizReponse)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($quizReponse->getQuestion() === $this) {
  73.                 $quizReponse->setQuestion(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78.     public function getQuiz(): ?Quiz
  79.     {
  80.         return $this->quiz;
  81.     }
  82.     public function setQuiz(?Quiz $quiz): self
  83.     {
  84.         $this->quiz $quiz;
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, QuestionOptions>
  89.      */
  90.     public function getOptions(): Collection
  91.     {
  92.         return $this->options;
  93.     }
  94.     public function addOption(QuestionOptions $option): self
  95.     {
  96.         if (!$this->options->contains($option)) {
  97.             $this->options->add($option);
  98.             $option->setQuizQuestion($this);
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeOption(QuestionOptions $option): self
  103.     {
  104.         if ($this->options->removeElement($option)) {
  105.             // set the owning side to null (unless already changed)
  106.             if ($option->getQuizQuestion() === $this) {
  107.                 $option->setQuizQuestion(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     public function getIdFileds(): ?string
  113.     {
  114.         return $this->IdFileds;
  115.     }
  116.     public function setIdFileds(string $IdFileds): self
  117.     {
  118.         $this->IdFileds $IdFileds;
  119.         return $this;
  120.     }
  121. }