<?php
namespace App\Entity;
use App\Repository\QuizQuestionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass=QuizQuestionRepository::class)
* @Serializer\ExclusionPolicy("ALL")
*/
class QuizQuestion extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Expose
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
*/
private $question;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
*/
private $questionType;
/**
* @ORM\Column(type="boolean")
* @Serializer\Expose
*/
private $isRequired;
/**
* @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
*/
private $image;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $points;
/**
* @ORM\ManyToOne(targetEntity=Quiz::class, inversedBy="quizQuestions")
*/
private $quiz;
/**
* @ORM\Column(type="time", nullable=true)
* @Serializer\Expose
*/
private $time;
/**
* @ORM\OneToMany(targetEntity=QuizAnswer::class, mappedBy="question", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
* @Serializer\Expose
*/
private $quizAnswers;
/**
* @ORM\OneToMany(targetEntity=UserQuizQuestion::class, mappedBy="quizQuestion", fetch="EXTRA_LAZY")
*/
private $userQuizQuestions;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Serializer\Expose
*/
private $isTrueOrFalse;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Serializer\Expose
*/
private $isMultipleChoice;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Expose
*/
private $helpText;
public function __construct()
{
$this->quizAnswers = new ArrayCollection();
$this->userQuizQuestions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getQuestion(): ?string
{
return $this->question;
}
public function setQuestion(string $question): self
{
$this->question = $question;
return $this;
}
public function getQuestionType(): ?string
{
return $this->questionType;
}
public function setQuestionType(string $questionType): self
{
$this->questionType = $questionType;
return $this;
}
public function isIsRequired(): ?bool
{
return $this->isRequired;
}
public function setIsRequired(bool $isRequired): self
{
$this->isRequired = $isRequired;
return $this;
}
public function getImage(): ?ImageManager
{
return $this->image;
}
public function setImage(?ImageManager $image): self
{
$this->image = $image;
return $this;
}
public function getPoints(): ?int
{
return $this->points;
}
public function setPoints(?int $points): self
{
$this->points = $points;
return $this;
}
public function getQuiz(): ?Quiz
{
return $this->quiz;
}
public function setQuiz(?Quiz $quiz): self
{
$this->quiz = $quiz;
return $this;
}
public function getTime(): ?\DateTimeInterface
{
return $this->time;
}
public function setTime(?\DateTimeInterface $time): self
{
$this->time = $time;
return $this;
}
/**
* @return Collection<int, QuizAnswer>
*/
public function getQuizAnswers(): Collection
{
return $this->quizAnswers;
}
public function addQuizAnswer(QuizAnswer $quizAnswer): self
{
if (!$this->quizAnswers->contains($quizAnswer)) {
$this->quizAnswers[] = $quizAnswer;
$quizAnswer->setQuestion($this);
}
return $this;
}
public function removeQuizAnswer(QuizAnswer $quizAnswer): self
{
if ($this->quizAnswers->removeElement($quizAnswer)) {
// set the owning side to null (unless already changed)
if ($quizAnswer->getQuestion() === $this) {
$quizAnswer->setQuestion(null);
}
}
return $this;
}
/**
* @return Collection<int, UserQuizQuestion>
*/
public function getUserQuizQuestions(): Collection
{
return $this->userQuizQuestions;
}
public function addUserQuizQuestion(UserQuizQuestion $userQuizQuestion): self
{
if (!$this->userQuizQuestions->contains($userQuizQuestion)) {
$this->userQuizQuestions[] = $userQuizQuestion;
$userQuizQuestion->setQuizQuestion($this);
}
return $this;
}
public function removeUserQuizQuestion(UserQuizQuestion $userQuizQuestion): self
{
if ($this->userQuizQuestions->removeElement($userQuizQuestion)) {
// set the owning side to null (unless already changed)
if ($userQuizQuestion->getQuizQuestion() === $this) {
$userQuizQuestion->setQuizQuestion(null);
}
}
return $this;
}
public function isIsTrueOrFalse(): ?bool
{
return $this->isTrueOrFalse;
}
public function setIsTrueOrFalse(?bool $isTrueOrFalse): self
{
$this->isTrueOrFalse = $isTrueOrFalse;
return $this;
}
public function isIsMultipleChoice(): ?bool
{
return $this->isMultipleChoice;
}
public function setIsMultipleChoice(?bool $isMultipleChoice): self
{
$this->isMultipleChoice = $isMultipleChoice;
return $this;
}
public function getHelpText(): ?string
{
return $this->helpText;
}
public function setHelpText(?string $helpText): self
{
$this->helpText = $helpText;
return $this;
}
}