src/Entity/QuestionResponse.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuestionResponseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassQuestionResponseRepository::class)]
  8. class QuestionResponse
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(inversedBy'responses')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?Question $question null;
  17.     #[ORM\ManyToOne(inversedBy'questionResponses')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?SurveyResponse $surveyResponse null;
  20.     #[ORM\Column(type'text'nullabletrue)]
  21.     private ?string $textResponse null;
  22.     #[ORM\ManyToMany(targetEntityQuestionOption::class)]
  23.     private Collection $selectedOptions;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $imageFilename null;
  26.     public function __construct()
  27.     {
  28.         $this->selectedOptions = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getQuestion(): ?Question
  35.     {
  36.         return $this->question;
  37.     }
  38.     public function setQuestion(?Question $question): self
  39.     {
  40.         $this->question $question;
  41.         return $this;
  42.     }
  43.     public function getSurveyResponse(): ?SurveyResponse
  44.     {
  45.         return $this->surveyResponse;
  46.     }
  47.     public function setSurveyResponse(?SurveyResponse $surveyResponse): self
  48.     {
  49.         $this->surveyResponse $surveyResponse;
  50.         return $this;
  51.     }
  52.     public function getTextResponse(): ?string
  53.     {
  54.         return $this->textResponse;
  55.     }
  56.     public function setTextResponse(?string $textResponse): self
  57.     {
  58.         $this->textResponse $textResponse;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, QuestionOption>
  63.      */
  64.     public function getSelectedOptions(): Collection
  65.     {
  66.         return $this->selectedOptions;
  67.     }
  68.     public function addSelectedOption(QuestionOption $option): self
  69.     {
  70.         if (!$this->selectedOptions->contains($option)) {
  71.             $this->selectedOptions->add($option);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeSelectedOption(QuestionOption $option): self
  76.     {
  77.         $this->selectedOptions->removeElement($option);
  78.         return $this;
  79.     }
  80.     public function getImageFilename(): ?string
  81.     {
  82.         return $this->imageFilename;
  83.     }
  84.     public function setImageFilename(?string $imageFilename): self
  85.     {
  86.         $this->imageFilename $imageFilename;
  87.         return $this;
  88.     }
  89. }