src/Entity/Question.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\DBAL\Types\Types;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\QuestionRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. #[ORM\Entity(repositoryClassQuestionRepository::class)]
  9. class Question
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $shortName null;
  17.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  18.     private ?string $question null;
  19.     #[ORM\ManyToOne(inversedBy'questions')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private ?SubThematic $subThematic null;
  22.     #[ORM\OneToMany(mappedBy'question'targetEntityEvaluationAnswer::class)]
  23.     private Collection $evaluationAnswers;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $description null;
  26.     public function __construct()
  27.     {
  28.         $this->evaluationAnswers = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getShortName(): ?string
  35.     {
  36.         return $this->shortName;
  37.     }
  38.     public function setShortName(?string $shortName): self
  39.     {
  40.         $this->shortName $shortName;
  41.         return $this;
  42.     }
  43.     public function getQuestion(): ?string
  44.     {
  45.         return $this->question;
  46.     }
  47.     public function setQuestion(?string $question): self
  48.     {
  49.         $this->question $question;
  50.         return $this;
  51.     }
  52.     public function getSubThematic(): ?SubThematic
  53.     {
  54.         return $this->subThematic;
  55.     }
  56.     public function setSubThematic(?SubThematic $subThematic): self
  57.     {
  58.         $this->subThematic $subThematic;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, EvaluationAnswer>
  63.      */
  64.     public function getEvaluationAnswers(): Collection
  65.     {
  66.         return $this->evaluationAnswers;
  67.     }
  68.     public function addEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
  69.     {
  70.         if (!$this->evaluationAnswers->contains($evaluationAnswer)) {
  71.             $this->evaluationAnswers->add($evaluationAnswer);
  72.             $evaluationAnswer->setQuestion($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeEvaluationAnswer(EvaluationAnswer $evaluationAnswer): self
  77.     {
  78.         if ($this->evaluationAnswers->removeElement($evaluationAnswer)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($evaluationAnswer->getQuestion() === $this) {
  81.                 $evaluationAnswer->setQuestion(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     public function getDescription(): ?string
  87.     {
  88.         return $this->description;
  89.     }
  90.     public function setDescription(?string $description): self
  91.     {
  92.         $this->description $description;
  93.         return $this;
  94.     }
  95. }