src/Entity/QuizEntry.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuizEntryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\Common\Collections\Collection;
  8. use JMS\Serializer\Annotation as Serializer;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Symfony\Component\HttpFoundation\File\File;
  11. #[ORM\Entity(repositoryClassQuizEntryRepository::class)]
  12. #[Vich\Uploadable]
  13. class QuizEntry
  14. {
  15.     #[ORM\Column(length1048nullabletrue)]
  16.     #[Serializer\Groups(["poi"])]
  17.     private ?string $question null;
  18.     #[ORM\Column(length1048nullabletrue)]
  19.     #[Serializer\Groups(["poi"])]
  20.     #[Serializer\SerializedName("audioTextUrl")]
  21.     private ?string $audio_text_url null;
  22.     #[ORM\Column(length1048nullabletrue)]
  23.     #[Serializer\Groups(["poi"])]
  24.     #[Serializer\SerializedName("imageUrl")]
  25.     private ?string $image_url null;
  26.  
  27.     #[ORM\Column(nullabletrue)]
  28.     #[Serializer\Groups(["poi"])]
  29.     #[Serializer\SerializedName("solutionIndex")]
  30.     private ?int $solution_index null;
  31.     #[ORM\ManyToOne(inversedBy'quizentries')]
  32.     #[Serializer\Groups(["poi"])]
  33.     private ?POI $poi null;
  34.     #[Vich\UploadableField(mapping'quizzes'fileNameProperty'audio_text_url')]
  35.     #[Serializer\Groups(["poi"])]
  36.     #[Serializer\SerializedName("audioTextFile")]
  37.     private ?File $audioTextFile null;
  38.     #[ORM\ManyToMany(targetEntityAudioTextBlock::class,cascade: ['persist''remove'])]
  39.     #[Serializer\Groups(["poi"])]
  40.     #[ORM\JoinTable(name:"quizentryanswers")]
  41.     private Collection $answers;
  42.     #[Vich\UploadableField(mapping'quizzes'fileNameProperty'image_url')]
  43.     #[Serializer\Groups(["poi"])]
  44.     #[Serializer\SerializedName("imageFile")]
  45.     private ?File $imageFile null;
  46.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  47.     #[ORM\JoinTable(name:"quizentry_audiotextbook_description")]
  48.     #[Serializer\Groups(["poi"])]
  49.     private ?AudioTextBlock $description null;
  50.     #[ORM\Id]
  51.     #[ORM\GeneratedValue]
  52.     #[ORM\Column]
  53.     #[Serializer\Groups(["poi"])]
  54.     private ?int $id null;
  55.     
  56.     public function __construct()
  57.     {
  58.         $this->answers = new ArrayCollection();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function setImageFile(?File $imageFile null): void
  65.     {
  66.         $this->imageFile $imageFile;
  67.  
  68.         if (null !== $imageFile) {
  69.             // It is required that at least one field changes if you are using doctrine
  70.             // otherwise the event listeners won't be called and the file is lost
  71.         }
  72.     }
  73.     public function getImageFile(): ?File
  74.     {
  75.         return $this->imageFile;
  76.     }
  77.     public function setAudioTextFile(?File $audioTextFile null): void
  78.     {
  79.         $this->audioTextFile $audioTextFile;
  80.  
  81.         if (null !== $audioTextFile) {
  82.             // It is required that at least one field changes if you are using doctrine
  83.             // otherwise the event listeners won't be called and the file is lost
  84.         }
  85.     }
  86.     public function getAudioTextFile(): ?File
  87.     {
  88.         return $this->audioTextFile;
  89.     }
  90.     public function getQuestion(): ?string
  91.     {
  92.         return $this->question;
  93.     }
  94.     public function setQuestion(?string $question): self
  95.     {
  96.         $this->question $question;
  97.         return $this;
  98.     }
  99.     public function getAudioTextUrl(): ?string
  100.     {
  101.         return $this->audio_text_url;
  102.     }
  103.     public function setAudioTextUrl(?string $audio_text_url): self
  104.     {
  105.         $this->audio_text_url $audio_text_url;
  106.         return $this;
  107.     }
  108.     public function getImageUrl(): ?string
  109.     {
  110.         return $this->image_url;
  111.     }
  112.     public function setImageUrl(?string $image_url): self
  113.     {
  114.         $this->image_url $image_url;
  115.         return $this;
  116.     }
  117.  
  118.     /**
  119.  * @return Collection<int, AudioTextBlock>
  120.  */
  121. public function getAnswers(): Collection
  122. {
  123.     return $this->answers;
  124. }
  125. public function addAnswer(AudioTextBlock $answer): self
  126. {
  127.     if (!$this->answers->contains($answer)) {
  128.         $this->answers->add($answer);
  129.     }
  130.     return $this;
  131. }
  132. public function removeAnswer(AudioTextBlock $answer): self
  133. {
  134.     $this->answers->removeElement($answer);
  135.     return $this;
  136. }
  137.     public function getSolutionIndex(): ?int
  138.     {
  139.         return $this->solution_index;
  140.     }
  141.     public function setSolutionIndex(?int $solution_index): self
  142.     {
  143.         $this->solution_index $solution_index;
  144.         return $this;
  145.     }
  146.     public function getPoi(): ?POI
  147.     {
  148.         return $this->poi;
  149.     }
  150.     public function setPoi(?POI $poi): self
  151.     {
  152.         $this->poi $poi;
  153.         return $this;
  154.     }
  155.     public function getDescription(): ?AudioTextBlock
  156.     {
  157.         return $this->description;
  158.     }
  159.     public function setDescription(?AudioTextBlock $description): self
  160.     {
  161.         $this->description $description;
  162.         return $this;
  163.     }
  164. }