src/Entity/UserQuizQuestion.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserQuizQuestionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=UserQuizQuestionRepository::class)
  9. * @ORM\AssociationOverrides({
  10. * @ORM\AssociationOverride(
  11. * name="createdBy",
  12. * inversedBy="userQuizQuestions",
  13. * joinColumns={@ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false, onDelete="CASCADE")}
  14. * )
  15. * })
  16. */
  17. class UserQuizQuestion extends BaseEntity
  18. {
  19. /**
  20. * @ORM\Id
  21. * @ORM\GeneratedValue
  22. * @ORM\Column(type="integer")
  23. */
  24. private $id;
  25. /**
  26. * @ORM\ManyToOne(targetEntity=QuizQuestion::class, inversedBy="userQuizQuestions")
  27. * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  28. */
  29. private $quizQuestion;
  30. /**
  31. * @ORM\ManyToMany(targetEntity=QuizAnswer::class, inversedBy="userQuizQuestions")
  32. */
  33. private $quizAnswers;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private $customAnswer;
  38. /**
  39. * @ORM\Column(type="string", length=255, nullable=true)
  40. */
  41. private $fileAnswer;
  42. /**
  43. * @ORM\Column(type="boolean", nullable=true)
  44. */
  45. private $trueOrFalseAnswer;
  46. /**
  47. * @ORM\ManyToOne(targetEntity=Module::class, inversedBy="userQuizQuestions")
  48. */
  49. private $module;
  50. public function __construct()
  51. {
  52. $this->quizAnswers = new ArrayCollection();
  53. }
  54. public function getId(): ?int
  55. {
  56. return $this->id;
  57. }
  58. public function getQuizQuestion(): ?QuizQuestion
  59. {
  60. return $this->quizQuestion;
  61. }
  62. public function setQuizQuestion(?QuizQuestion $quizQuestion): self
  63. {
  64. $this->quizQuestion = $quizQuestion;
  65. return $this;
  66. }
  67. /**
  68. * @return Collection<int, QuizAnswer>
  69. */
  70. public function getQuizAnswers(): Collection
  71. {
  72. return $this->quizAnswers;
  73. }
  74. public function addQuizAnswer(QuizAnswer $quizAnswer): self
  75. {
  76. if (!$this->quizAnswers->contains($quizAnswer)) {
  77. $this->quizAnswers[] = $quizAnswer;
  78. }
  79. return $this;
  80. }
  81. public function removeQuizAnswer(QuizAnswer $quizAnswer): self
  82. {
  83. $this->quizAnswers->removeElement($quizAnswer);
  84. return $this;
  85. }
  86. public function getCustomAnswer(): ?string
  87. {
  88. return $this->customAnswer;
  89. }
  90. public function setCustomAnswer(?string $customAnswer): self
  91. {
  92. $this->customAnswer = $customAnswer;
  93. return $this;
  94. }
  95. public function getFileAnswer(): ?string
  96. {
  97. return $this->fileAnswer;
  98. }
  99. public function setFileAnswer(?string $fileAnswer): self
  100. {
  101. $this->fileAnswer = $fileAnswer;
  102. return $this;
  103. }
  104. public function isTrueOrFalseAnswer(): ?bool
  105. {
  106. return $this->trueOrFalseAnswer;
  107. }
  108. public function setTrueOrFalseAnswer(?bool $trueOrFalseAnswer): self
  109. {
  110. $this->trueOrFalseAnswer = $trueOrFalseAnswer;
  111. return $this;
  112. }
  113. public function getModule(): ?Module
  114. {
  115. return $this->module;
  116. }
  117. public function setModule(?Module $module): self
  118. {
  119. $this->module = $module;
  120. return $this;
  121. }
  122. }