src/Entity/Core/Textbook/TextbookSessionResponse.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Textbook;
  3. use App\Entity\User\User;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * link the response to the student and session
  8. */
  9. #[ORM\Table('textbook_session_response')]
  10. #[ORM\Entity(repositoryClass: TextbookSessionResponseRepository::class)]
  11. class TextbookSessionResponse
  12. {
  13. /**
  14. * @var int
  15. */
  16. #[ORM\Column(name: 'id', type: 'integer')]
  17. #[ORM\Id]
  18. #[ORM\GeneratedValue(strategy: 'AUTO')]
  19. private $id;
  20. /**
  21. * @var User
  22. */
  23. #[ORM\JoinColumn(name: 'student', referencedColumnName: 'id')]
  24. #[ORM\ManyToOne(targetEntity: User::class)]
  25. private $student;
  26. /**
  27. * @var TextbookSession
  28. */
  29. #[ORM\JoinColumn(name: 'textbook_session', referencedColumnName: 'id', onDelete: 'CASCADE')]
  30. #[ORM\ManyToOne(targetEntity: TextbookSession::class)]
  31. private $textbookSession;
  32. /**
  33. * @var TextbookSubTopic
  34. */
  35. #[ORM\JoinColumn(name: 'textbook_sub_topic', referencedColumnName: 'id', onDelete: 'CASCADE')]
  36. #[ORM\ManyToOne(targetEntity: TextbookSubTopic::class)]
  37. private $textbookSubTopic;
  38. /**
  39. * @var TextbookSubTopicQuestion
  40. */
  41. #[ORM\JoinColumn(name: 'question', referencedColumnName: 'id', onDelete: 'CASCADE')]
  42. #[ORM\ManyToOne(targetEntity: TextbookSubTopicQuestion::class)]
  43. private $textbookSubTopicQuestion;
  44. /**
  45. * @var TextbookSubTopicAnswer
  46. */
  47. #[ORM\JoinColumn(name: 'answer_chosen', referencedColumnName: 'id', onDelete: 'CASCADE')]
  48. #[ORM\ManyToOne(targetEntity: TextbookSubTopicAnswer::class)]
  49. private $answerChosen;
  50. /**
  51. * @var bool
  52. */
  53. #[ORM\Column(name: 'is_valid', type: 'boolean', nullable: true, options: ['default' => true])]
  54. private $isValid = true;
  55. /**
  56. * @var DateTime
  57. */
  58. #[ORM\Column(name: 'archived_at', type: 'datetime', nullable: true)]
  59. private $archivedAt;
  60. public function __construct($student, $textbookSession, $textbookSubTopic, $textbookSubTopicQuestion, $answerChosen)
  61. {
  62. $this->student = $student;
  63. $this->textbookSession = $textbookSession;
  64. $this->textbookSubTopic = $textbookSubTopic;
  65. $this->textbookSubTopicQuestion = $textbookSubTopicQuestion;
  66. $this->answerChosen = $answerChosen;
  67. }
  68. /**
  69. * @return User
  70. */
  71. public function getStudent()
  72. {
  73. return $this->student;
  74. }
  75. /**
  76. * @param User $student
  77. */
  78. public function setStudent($student)
  79. {
  80. $this->student = $student;
  81. }
  82. /**
  83. * @return TextbookSession
  84. */
  85. public function getSession()
  86. {
  87. return $this->textbookSession;
  88. }
  89. /**
  90. * @param TextbookSession $session
  91. */
  92. public function setSession($session)
  93. {
  94. $this->textbookSession = $session;
  95. }
  96. /**
  97. * @return TextbookSubTopicQuestion
  98. */
  99. public function getQuestion()
  100. {
  101. return $this->textbookSubTopicQuestion;
  102. }
  103. /**
  104. * @param TextbookSubTopicQuestion $question
  105. */
  106. public function setQuestion($question)
  107. {
  108. $this->textbookSubTopicQuestion = $question;
  109. }
  110. /**
  111. * @return TextbookSubTopicAnswer
  112. */
  113. public function getAnswerChosen()
  114. {
  115. return $this->answerChosen;
  116. }
  117. /**
  118. * @param TextbookSubTopicAnswer $answerChosen
  119. */
  120. public function setAnswerChosen($answerChosen)
  121. {
  122. $this->answerChosen = $answerChosen;
  123. }
  124. public function getTextbookSubTopic(): TextbookSubTopic
  125. {
  126. return $this->textbookSubTopic;
  127. }
  128. public function isValid(): bool
  129. {
  130. return $this->isValid;
  131. }
  132. public function setIsValid(bool $isValid): void
  133. {
  134. $this->isValid = $isValid;
  135. }
  136. public function getArchivedAt(): ?DateTime
  137. {
  138. return $this->archivedAt;
  139. }
  140. public function setArchivedAt(DateTime $archivedAt): void
  141. {
  142. $this->archivedAt = $archivedAt;
  143. }
  144. }