<?php
namespace App\Entity;
use App\Repository\QuizEntryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use JMS\Serializer\Annotation as Serializer;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
#[ORM\Entity(repositoryClass: QuizEntryRepository::class)]
#[Vich\Uploadable]
class QuizEntry
{
#[ORM\Column(length: 1048, nullable: true)]
#[Serializer\Groups(["poi"])]
private ?string $question = null;
#[ORM\Column(length: 1048, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("audioTextUrl")]
private ?string $audio_text_url = null;
#[ORM\Column(length: 1048, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("imageUrl")]
private ?string $image_url = null;
#[ORM\Column(nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("solutionIndex")]
private ?int $solution_index = null;
#[ORM\ManyToOne(inversedBy: 'quizentries')]
#[Serializer\Groups(["poi"])]
private ?POI $poi = null;
#[Vich\UploadableField(mapping: 'quizzes', fileNameProperty: 'audio_text_url')]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("audioTextFile")]
private ?File $audioTextFile = null;
#[ORM\ManyToMany(targetEntity: AudioTextBlock::class,cascade: ['persist', 'remove'])]
#[Serializer\Groups(["poi"])]
#[ORM\JoinTable(name:"quizentryanswers")]
private Collection $answers;
#[Vich\UploadableField(mapping: 'quizzes', fileNameProperty: 'image_url')]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("imageFile")]
private ?File $imageFile = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[ORM\JoinTable(name:"quizentry_audiotextbook_description")]
#[Serializer\Groups(["poi"])]
private ?AudioTextBlock $description = null;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Serializer\Groups(["poi"])]
private ?int $id = null;
public function __construct()
{
$this->answers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setAudioTextFile(?File $audioTextFile = null): void
{
$this->audioTextFile = $audioTextFile;
if (null !== $audioTextFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
}
}
public function getAudioTextFile(): ?File
{
return $this->audioTextFile;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(?string $question): self
{
$this->question = $question;
return $this;
}
public function getAudioTextUrl(): ?string
{
return $this->audio_text_url;
}
public function setAudioTextUrl(?string $audio_text_url): self
{
$this->audio_text_url = $audio_text_url;
return $this;
}
public function getImageUrl(): ?string
{
return $this->image_url;
}
public function setImageUrl(?string $image_url): self
{
$this->image_url = $image_url;
return $this;
}
/**
* @return Collection<int, AudioTextBlock>
*/
public function getAnswers(): Collection
{
return $this->answers;
}
public function addAnswer(AudioTextBlock $answer): self
{
if (!$this->answers->contains($answer)) {
$this->answers->add($answer);
}
return $this;
}
public function removeAnswer(AudioTextBlock $answer): self
{
$this->answers->removeElement($answer);
return $this;
}
public function getSolutionIndex(): ?int
{
return $this->solution_index;
}
public function setSolutionIndex(?int $solution_index): self
{
$this->solution_index = $solution_index;
return $this;
}
public function getPoi(): ?POI
{
return $this->poi;
}
public function setPoi(?POI $poi): self
{
$this->poi = $poi;
return $this;
}
public function getDescription(): ?AudioTextBlock
{
return $this->description;
}
public function setDescription(?AudioTextBlock $description): self
{
$this->description = $description;
return $this;
}
}