<?php
namespace App\Entity;
use App\Repository\UserQuizQuestionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=UserQuizQuestionRepository::class)
* @ORM\AssociationOverrides({
* @ORM\AssociationOverride(
* name="createdBy",
* inversedBy="userQuizQuestions",
* joinColumns={@ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false, onDelete="CASCADE")}
* )
* })
*/
class UserQuizQuestion extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=QuizQuestion::class, inversedBy="userQuizQuestions")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $quizQuestion;
/**
* @ORM\ManyToMany(targetEntity=QuizAnswer::class, inversedBy="userQuizQuestions")
*/
private $quizAnswers;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $customAnswer;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fileAnswer;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $trueOrFalseAnswer;
/**
* @ORM\ManyToOne(targetEntity=Module::class, inversedBy="userQuizQuestions")
*/
private $module;
public function __construct()
{
$this->quizAnswers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getQuizQuestion(): ?QuizQuestion
{
return $this->quizQuestion;
}
public function setQuizQuestion(?QuizQuestion $quizQuestion): self
{
$this->quizQuestion = $quizQuestion;
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;
}
return $this;
}
public function removeQuizAnswer(QuizAnswer $quizAnswer): self
{
$this->quizAnswers->removeElement($quizAnswer);
return $this;
}
public function getCustomAnswer(): ?string
{
return $this->customAnswer;
}
public function setCustomAnswer(?string $customAnswer): self
{
$this->customAnswer = $customAnswer;
return $this;
}
public function getFileAnswer(): ?string
{
return $this->fileAnswer;
}
public function setFileAnswer(?string $fileAnswer): self
{
$this->fileAnswer = $fileAnswer;
return $this;
}
public function isTrueOrFalseAnswer(): ?bool
{
return $this->trueOrFalseAnswer;
}
public function setTrueOrFalseAnswer(?bool $trueOrFalseAnswer): self
{
$this->trueOrFalseAnswer = $trueOrFalseAnswer;
return $this;
}
public function getModule(): ?Module
{
return $this->module;
}
public function setModule(?Module $module): self
{
$this->module = $module;
return $this;
}
}