src/Entity/Core/ReadingTest/ReadingTestResponse.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\ReadingTest;
  3. use App\Entity\Core\Answer;
  4. use App\Entity\Core\Mathproblem;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Table('reading_test_response')]
  8. #[ORM\Entity(repositoryClass: ReadingTestResponseRepository::class)]
  9. class ReadingTestResponse
  10. {
  11. /**
  12. * @var int
  13. */
  14. #[ORM\Column(name: 'id', type: 'integer')]
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue(strategy: 'AUTO')]
  17. private $id;
  18. /**
  19. * @var ReadingTestUnit
  20. */
  21. #[ORM\JoinColumn(name: 'reading_test_unit', referencedColumnName: 'id', onDelete: 'CASCADE')]
  22. #[ORM\ManyToOne(targetEntity: ReadingTestUnit::class, inversedBy: 'readingTestResponses')]
  23. private $readingTestUnit;
  24. /**
  25. * @var ReadingTest
  26. */
  27. #[ORM\JoinColumn(name: 'readingTest', referencedColumnName: 'id')]
  28. #[ORM\ManyToOne(targetEntity: ReadingTest::class)]
  29. private $readingTest;
  30. /**
  31. * @var Mathproblem
  32. */
  33. #[ORM\JoinColumn(name: 'mathproblem', referencedColumnName: 'id', onDelete: 'CASCADE')]
  34. #[ORM\ManyToOne(targetEntity: Mathproblem::class)]
  35. private $mathproblem;
  36. /**
  37. * @var Answer
  38. */
  39. #[ORM\JoinColumn(name: 'answer', referencedColumnName: 'id', onDelete: 'RESTRICT')]
  40. #[ORM\ManyToOne(targetEntity: Answer::class)]
  41. private $answerChosen;
  42. /**
  43. * @var DateTime
  44. */
  45. #[ORM\Column(name: 'createdAt', type: 'datetime', nullable: true)]
  46. private $createdAt;
  47. /**
  48. * @var string
  49. */
  50. #[ORM\Column(name: 'answer_text', type: 'text', nullable: true)]
  51. private $answerText;
  52. /**
  53. * @var int
  54. */
  55. #[ORM\Column(name: 'position', type: 'integer')]
  56. private $position;
  57. public function getId(): int
  58. {
  59. return $this->id;
  60. }
  61. public function setId(int $id): void
  62. {
  63. $this->id = $id;
  64. }
  65. public function getReadingTestUnit(): ReadingTestUnit
  66. {
  67. return $this->readingTestUnit;
  68. }
  69. public function setReadingTestUnit(ReadingTestUnit $readingTestUnit): void
  70. {
  71. $this->readingTestUnit = $readingTestUnit;
  72. }
  73. public function getReadingTest(): ReadingTest
  74. {
  75. return $this->readingTest;
  76. }
  77. public function setReadingTest(ReadingTest $readingTest): void
  78. {
  79. $this->readingTest = $readingTest;
  80. }
  81. public function getMathproblem(): Mathproblem
  82. {
  83. return $this->mathproblem;
  84. }
  85. public function setMathproblem(Mathproblem $mathproblem): void
  86. {
  87. $this->mathproblem = $mathproblem;
  88. }
  89. /**
  90. * @return Answer
  91. */
  92. public function getAnswerChosen()
  93. {
  94. return $this->answerChosen;
  95. }
  96. /**
  97. * @param Answer $answerChosen
  98. * @return $this
  99. */
  100. public function setAnswerChosen($answerChosen)
  101. {
  102. $this->answerChosen = $answerChosen;
  103. $this->createdAt = new DateTime("now");
  104. return $this;
  105. }
  106. /**
  107. * @return DateTime
  108. */
  109. public function getCreatedAt(): ?DateTime
  110. {
  111. return $this->createdAt;
  112. }
  113. /**
  114. * @param DateTime $createdAt
  115. */
  116. public function setCreatedAt(?DateTime $createdAt): void
  117. {
  118. $this->createdAt = $createdAt;
  119. }
  120. public function getAnswerText(): string
  121. {
  122. return $this->answerText;
  123. }
  124. public function setAnswerText(string $answerText): void
  125. {
  126. $this->answerText = $answerText;
  127. }
  128. /**
  129. * @return int
  130. */
  131. public function getPosition()
  132. {
  133. return $this->position;
  134. }
  135. /**
  136. * @param int $position
  137. * @return $this
  138. */
  139. public function setPosition($position)
  140. {
  141. $this->position = $position;
  142. return $this;
  143. }
  144. }