src/CoreBundle/Entity/TrainingResponse.php line 13

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JsonSerializable;
  5. /**
  6. * @ORM\Table("training_response")
  7. * @ORM\Entity(repositoryClass="CoreBundle\Entity\TrainingResponseRepository")
  8. */
  9. class TrainingResponse implements JsonSerializable
  10. {
  11. /**
  12. * @var int
  13. *
  14. * @ORM\Column(name="id", type="integer")
  15. * @ORM\Id
  16. * @ORM\GeneratedValue(strategy="AUTO")
  17. */
  18. private $id;
  19. /**
  20. * @var TrainingUnit
  21. *
  22. * @ORM\ManyToOne(targetEntity="TrainingUnit", inversedBy="TrainingResponses")
  23. * @ORM\JoinColumn(name="training_unit", referencedColumnName="id", onDelete="CASCADE")
  24. */
  25. private $trainingUnit;
  26. /**
  27. * @var Mathproblem
  28. *
  29. * @ORM\ManyToOne(targetEntity="Mathproblem")
  30. * @ORM\JoinColumn(name="mathproblem", referencedColumnName="id", onDelete="CASCADE")
  31. */
  32. private $mathproblem;
  33. /**
  34. * @var Answer
  35. *
  36. * @ORM\ManyToOne(targetEntity="CoreBundle\Entity\Answer")
  37. * @ORM\JoinColumn(name="answer", referencedColumnName="id", onDelete="RESTRICT")
  38. */
  39. private $answerChosen;
  40. /**
  41. * @var \DateTime
  42. *
  43. * @ORM\Column(name="end_time", type="datetime", nullable=true)
  44. */
  45. private $endTime = null;
  46. /**
  47. * @var \DateTime
  48. *
  49. * @ORM\Column(name="start_time", type="datetime")
  50. */
  51. private $startTime;
  52. /**
  53. * @ORM\ManyToOne(targetEntity="Answer")
  54. * @ORM\JoinColumn(name="second_answer", referencedColumnName="id", onDelete="RESTRICT", nullable=true)
  55. */
  56. private ?Answer $secondAnswer = null;
  57. /**
  58. * @var bool
  59. *
  60. * @ORM\Column(name="repetition_flag", type="boolean", nullable=true)
  61. */
  62. private $repetitionFlag;
  63. /**
  64. * @var string|null
  65. * @ORM\Column(name="answer_text", type="text", nullable=true)
  66. */
  67. private string|null $answerText = null;
  68. /**
  69. * @var string|null
  70. * @ORM\Column(name="second_answer_text", type="text", nullable=true)
  71. */
  72. private string|null $secondAnswerText = null;
  73. /**
  74. * @var bool
  75. *
  76. * @ORM\Column(name="is_valid", type="boolean", nullable=true, options={"default":true})
  77. */
  78. private $isValid = true;
  79. /**
  80. * @var \DateTime
  81. *
  82. * @ORM\Column(name="archived_at", type="datetime", nullable=true)
  83. */
  84. private $archivedAt;
  85. /**
  86. * Get id.
  87. *
  88. * @return int
  89. */
  90. public function getId()
  91. {
  92. return $this->id;
  93. }
  94. /**
  95. * Set TrainingUnit.
  96. *
  97. * @param TrainingUnit $TrainingUnit
  98. *
  99. * @return TrainingResponse
  100. */
  101. public function setTrainingUnit($TrainingUnit)
  102. {
  103. $this->trainingUnit = $TrainingUnit;
  104. return $this;
  105. }
  106. /**
  107. * Get TrainingUnit.
  108. *
  109. * @return TrainingUnit
  110. */
  111. public function getTrainingUnit()
  112. {
  113. return $this->trainingUnit;
  114. }
  115. /**
  116. * Set mathproblem.
  117. *
  118. * @param Mathproblem $mathproblem
  119. *
  120. * @return TrainingResponse
  121. */
  122. public function setMathproblem($mathproblem)
  123. {
  124. $this->mathproblem = $mathproblem;
  125. return $this;
  126. }
  127. /**
  128. * Get mathproblem.
  129. *
  130. * @return Mathproblem
  131. */
  132. public function getMathproblem()
  133. {
  134. return $this->mathproblem;
  135. }
  136. /**
  137. * Set answerChosen.
  138. *
  139. * @param Answer $answerChosen
  140. *
  141. * @return TrainingResponse
  142. */
  143. public function setAnswerChosen($answerChosen)
  144. {
  145. $this->answerChosen = $answerChosen;
  146. return $this;
  147. }
  148. /**
  149. * Get answerChosen.
  150. *
  151. * @return Answer
  152. */
  153. public function getAnswerChosen()
  154. {
  155. return $this->answerChosen;
  156. }
  157. /**
  158. * @param \DateTime $endTime
  159. */
  160. public function setEndTime($endTime)
  161. {
  162. $this->endTime = $endTime;
  163. }
  164. /**
  165. * @return \DateTime
  166. */
  167. public function getEndTime()
  168. {
  169. return $this->endTime;
  170. }
  171. /**
  172. * @param \DateTime $startTime
  173. */
  174. public function setStartTime($startTime)
  175. {
  176. $this->startTime = $startTime;
  177. }
  178. /**
  179. * @return \DateTime
  180. */
  181. public function getStartTime()
  182. {
  183. return $this->startTime;
  184. }
  185. public function getSecondAnswer(): ?Answer
  186. {
  187. return $this->secondAnswer;
  188. }
  189. /**
  190. * @param Answer $secondAnswer
  191. */
  192. public function setSecondAnswer($secondAnswer)
  193. {
  194. $this->secondAnswer = $secondAnswer;
  195. }
  196. public function getRepetitionFlag(): ?bool
  197. {
  198. return $this->repetitionFlag;
  199. }
  200. public function setRepetitionFlag(?bool $repetitionFlag)
  201. {
  202. $this->repetitionFlag = $repetitionFlag;
  203. }
  204. /**
  205. * @return bool
  206. */
  207. public function isValid(): bool
  208. {
  209. return $this->isValid;
  210. }
  211. /**
  212. * @param bool $isValid
  213. */
  214. public function setIsValid(bool $isValid): void
  215. {
  216. $this->isValid = $isValid;
  217. }
  218. /**
  219. * @return \DateTime|null
  220. */
  221. public function getArchivedAt(): ?\DateTime
  222. {
  223. return $this->archivedAt;
  224. }
  225. /**
  226. * @param \DateTime $archivedAt
  227. */
  228. public function setArchivedAt(\DateTime $archivedAt): void
  229. {
  230. $this->archivedAt = $archivedAt;
  231. }
  232. /**
  233. * @return string|null
  234. */
  235. function getAnswerText(): string|null {
  236. return $this->answerText;
  237. }
  238. /**
  239. * @param string $answerText
  240. * @return $this
  241. */
  242. function setAnswerText(string $answerText):self {
  243. $this->answerText = $answerText;
  244. return $this;
  245. }
  246. /**
  247. * @return string|null
  248. */
  249. function getSecondAnswerText(): string|null {
  250. return $this->secondAnswerText;
  251. }
  252. /**
  253. * @param string $secondAnswerText
  254. * @return $this
  255. */
  256. function setSecondAnswerText(string $secondAnswerText):self {
  257. $this->secondAnswerText = $secondAnswerText;
  258. return $this;
  259. }
  260. public function jsonSerialize(): mixed
  261. {
  262. return [
  263. "id" => $this->getId(),
  264. "answer" => $this->getAnswerChosen(),
  265. "secondAnswer" => $this->getSecondAnswer(),
  266. ];
  267. }
  268. }