src/Entity/QuizAnswer.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\QuizAnswerRepository")
  8.  */
  9. class QuizAnswer
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="bigint")
  15.      */
  16.     private $id;
  17.     
  18.     /**
  19.      * @ORM\Column(type="text")
  20.      */
  21.     private $answer;
  22.     
  23.     //Note: Needs linked to QuizQuestion in addition to QuizQuestionOption due to text fields having no associated question option
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity="App\Entity\QuizQuestion", inversedBy="quizAnswers")
  26.      * @ORM\JoinColumn(name="quiz_question_id", referencedColumnName="id", onDelete="SET NULL")
  27.      */
  28.     private $quizQuestion;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\QuizQuestionOption", inversedBy="quizAnswers")
  31.      * @ORM\JoinColumn(name="quiz_option_id", referencedColumnName="id", onDelete="SET NULL")
  32.      */
  33.     private $quizQuestionOption;
  34.     
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\QuizResponse", inversedBy="quizAnswers")
  37.      * @ORM\JoinColumn(name="quiz_response_id", referencedColumnName="id", onDelete="SET NULL")
  38.      */
  39.     private $quizResponse;
  40.     
  41.     
  42.     
  43.     
  44.     public function __construct ()
  45.     {
  46.         $this->answer "";
  47.         $this->sort 0;
  48.     }
  49.     public function getId()
  50.     {
  51.         return $this->id;
  52.     }
  53.     
  54.     public function getAnswer(): ?string
  55.     {
  56.         return $this->answer;
  57.     }
  58.     
  59.     public function setAnswer (string $answer null): ?self
  60.     {
  61.         $this->answer $answer $answer "";
  62.         return $this;
  63.     }
  64.     
  65.     public function getQuizQuestionOption(): ?QuizQuestionOption
  66.     {
  67.         return $this->quizQuestionOption;
  68.     }
  69.     
  70.     public function setQuizQuestionOption(?QuizQuestionOption $quizQuestionOption null): self
  71.     {
  72.         $this->quizQuestionOption $quizQuestionOption;
  73.         return $this;
  74.     }
  75.     public function getQuizQuestion(): ?QuizQuestion
  76.     {
  77.         return $this->quizQuestion;
  78.     }
  79.     
  80.     public function setQuizQuestion(?QuizQuestion $quizQuestion null): self
  81.     {
  82.         $this->quizQuestion $quizQuestion;
  83.         return $this;
  84.     }
  85.     public function getQuizResponse(): ?QuizResponse
  86.     {
  87.         return $this->quizResponse;
  88.     }
  89.     
  90.     public function setQuizResponse(?QuizResponse $quizResponse null): self
  91.     {
  92.         $this->quizResponse $quizResponse;
  93.         return $this;
  94.     }
  95.     
  96.     public function __toString ()
  97.     {
  98.         return $this->getAnswer();
  99.     }
  100.     
  101. }