<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\QuizAnswerRepository")
*/
class QuizAnswer
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="bigint")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $answer;
//Note: Needs linked to QuizQuestion in addition to QuizQuestionOption due to text fields having no associated question option
/**
* @ORM\ManyToOne(targetEntity="App\Entity\QuizQuestion", inversedBy="quizAnswers")
* @ORM\JoinColumn(name="quiz_question_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $quizQuestion;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\QuizQuestionOption", inversedBy="quizAnswers")
* @ORM\JoinColumn(name="quiz_option_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $quizQuestionOption;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\QuizResponse", inversedBy="quizAnswers")
* @ORM\JoinColumn(name="quiz_response_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $quizResponse;
public function __construct ()
{
$this->answer = "";
$this->sort = 0;
}
public function getId()
{
return $this->id;
}
public function getAnswer(): ?string
{
return $this->answer;
}
public function setAnswer (string $answer = null): ?self
{
$this->answer = $answer ? $answer : "";
return $this;
}
public function getQuizQuestionOption(): ?QuizQuestionOption
{
return $this->quizQuestionOption;
}
public function setQuizQuestionOption(?QuizQuestionOption $quizQuestionOption = null): self
{
$this->quizQuestionOption = $quizQuestionOption;
return $this;
}
public function getQuizQuestion(): ?QuizQuestion
{
return $this->quizQuestion;
}
public function setQuizQuestion(?QuizQuestion $quizQuestion = null): self
{
$this->quizQuestion = $quizQuestion;
return $this;
}
public function getQuizResponse(): ?QuizResponse
{
return $this->quizResponse;
}
public function setQuizResponse(?QuizResponse $quizResponse = null): self
{
$this->quizResponse = $quizResponse;
return $this;
}
public function __toString ()
{
return $this->getAnswer();
}
}