src/CoreBundle/Entity/HomeworkResponse.php line 12

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JsonSerializable;
  5. /**
  6. * @ORM\Table("homework_response")
  7. * @ORM\Entity(repositoryClass="CoreBundle\Entity\HomeworkResponseRepository")
  8. */
  9. class HomeworkResponse 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 HomeworkUnit
  21. *
  22. * @ORM\ManyToOne(targetEntity="HomeworkUnit", inversedBy="homeworkResponses")
  23. * @ORM\JoinColumn(name="homework_unit", referencedColumnName="id", onDelete="CASCADE")
  24. */
  25. private $homeworkUnit;
  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. * @var Answer
  54. *
  55. * @ORM\ManyToOne(targetEntity="CoreBundle\Entity\Answer")
  56. * @ORM\JoinColumn(name="second_answer", referencedColumnName="id", onDelete="RESTRICT", nullable=true)
  57. */
  58. private $secondAnswer;
  59. /**
  60. * @var string|null
  61. * @ORM\Column(name="answer_text", type="text", nullable=true)
  62. */
  63. private string|null $answerText = null;
  64. /**
  65. * @var string|null
  66. * @ORM\Column(name="second_answer_text", type="text", nullable=true)
  67. */
  68. private string|null $secondAnswerText = null;
  69. /**
  70. * @var int
  71. *
  72. * @ORM\Column(name="seconds_delayed", type="integer", nullable=false, options={"default":0})
  73. */
  74. private $secondsDelayed;
  75. /**
  76. * @ORM\Column(name="repetition_flag", type="boolean", nullable=true)
  77. */
  78. private $repetitionFlag;
  79. /**
  80. * @var bool
  81. *
  82. * @ORM\Column(name="is_valid", type="boolean", nullable=true, options={"default":true})
  83. */
  84. private $isValid = true;
  85. /**
  86. * @var \DateTime
  87. *
  88. * @ORM\Column(name="archived_at", type="datetime", nullable=true)
  89. */
  90. private $archivedAt;
  91. /**
  92. * Get id.
  93. *
  94. * @return int
  95. */
  96. public function getId()
  97. {
  98. return $this->id;
  99. }
  100. /**
  101. * Set HomeworkUnit.
  102. *
  103. * @param HomeworkUnit $homeworkUnit
  104. *
  105. * @return HomeworkResponse
  106. */
  107. public function setHomeworkUnit($homeworkUnit)
  108. {
  109. $this->homeworkUnit = $homeworkUnit;
  110. return $this;
  111. }
  112. /**
  113. * Get HomeworkUnit.
  114. *
  115. * @return HomeworkUnit
  116. */
  117. public function getHomeworkUnit()
  118. {
  119. return $this->homeworkUnit;
  120. }
  121. /**
  122. * Set mathproblem.
  123. *
  124. * @param Mathproblem $mathproblem
  125. *
  126. * @return HomeworkResponse
  127. */
  128. public function setMathproblem($mathproblem)
  129. {
  130. $this->mathproblem = $mathproblem;
  131. return $this;
  132. }
  133. /**
  134. * Get mathproblem.
  135. *
  136. * @return Mathproblem
  137. */
  138. public function getMathproblem()
  139. {
  140. return $this->mathproblem;
  141. }
  142. /**
  143. * Set answerChosen.
  144. *
  145. * @param Answer $answerChosen
  146. *
  147. * @return HomeworkResponse
  148. */
  149. public function setAnswerChosen($answerChosen)
  150. {
  151. $this->answerChosen = $answerChosen;
  152. return $this;
  153. }
  154. /**
  155. * Get answerChosen.
  156. *
  157. * @return Answer
  158. */
  159. public function getAnswerChosen()
  160. {
  161. return $this->answerChosen;
  162. }
  163. /**
  164. * @param \DateTime $endTime
  165. */
  166. public function setEndTime($endTime)
  167. {
  168. $this->endTime = $endTime;
  169. }
  170. /**
  171. * @return \DateTime
  172. */
  173. public function getEndTime()
  174. {
  175. return $this->endTime;
  176. }
  177. /**
  178. * @param \DateTime $startTime
  179. */
  180. public function setStartTime($startTime)
  181. {
  182. $this->startTime = $startTime;
  183. }
  184. /**
  185. * @return \DateTime
  186. */
  187. public function getStartTime()
  188. {
  189. return $this->startTime;
  190. }
  191. /**
  192. * @return Answer
  193. */
  194. public function getSecondAnswer()
  195. {
  196. return $this->secondAnswer;
  197. }
  198. /**
  199. * @param Answer $secondAnswer
  200. */
  201. public function setSecondAnswer($secondAnswer)
  202. {
  203. $this->secondAnswer = $secondAnswer;
  204. }
  205. /**
  206. * @return string|null
  207. */
  208. function getAnswerText(): string|null {
  209. return $this->answerText;
  210. }
  211. /**
  212. * @param string $answerText
  213. * @return $this
  214. */
  215. function setAnswerText(string $answerText):self {
  216. $this->answerText = $answerText;
  217. return $this;
  218. }
  219. /**
  220. * @return string|null
  221. */
  222. function getSecondAnswerText(): string|null {
  223. return $this->secondAnswerText;
  224. }
  225. /**
  226. * @param string $secondAnswerText
  227. * @return $this
  228. */
  229. function setSecondAnswerText(string $secondAnswerText):self {
  230. $this->secondAnswerText = $secondAnswerText;
  231. return $this;
  232. }
  233. /**
  234. * @return int
  235. */
  236. public function getSecondsDelayed()
  237. {
  238. return $this->secondsDelayed;
  239. }
  240. /**
  241. * @param int $secondsDelayed
  242. * @return $this
  243. */
  244. public function setSecondsDelayed($secondsDelayed)
  245. {
  246. $this->secondsDelayed = $secondsDelayed;
  247. return $this;
  248. }
  249. /**
  250. * @return mixed
  251. */
  252. public function getRepetitionFlag()
  253. {
  254. return $this->repetitionFlag;
  255. }
  256. /**
  257. * @param mixed $repetitionFlag
  258. */
  259. public function setRepetitionFlag($repetitionFlag)
  260. {
  261. $this->repetitionFlag = $repetitionFlag;
  262. }
  263. /**
  264. * @return bool
  265. */
  266. public function isValid(): bool
  267. {
  268. return $this->isValid;
  269. }
  270. /**
  271. * @param bool $isValid
  272. */
  273. public function setIsValid(bool $isValid): void
  274. {
  275. $this->isValid = $isValid;
  276. }
  277. /**
  278. * @return \DateTime|null
  279. */
  280. public function getArchivedAt(): ?\DateTime
  281. {
  282. return $this->archivedAt;
  283. }
  284. /**
  285. * @param \DateTime $archivedAt
  286. */
  287. public function setArchivedAt(\DateTime $archivedAt): void
  288. {
  289. $this->archivedAt = $archivedAt;
  290. }
  291. public function jsonSerialize(): mixed
  292. {
  293. return [
  294. 'id' => $this->id,
  295. 'answerChosen' => $this->answerChosen,
  296. 'mathproblem' => $this->mathproblem,
  297. 'startTime' => $this->startTime,
  298. 'endTime' => $this->endTime,
  299. 'secondAnswer' => $this->secondAnswer,
  300. 'archivedAt' => $this->archivedAt,
  301. 'homeworkUnit' => $this->homeworkUnit,
  302. 'isValid' => $this->isValid,
  303. 'repetitionFlag' => $this->repetitionFlag,
  304. 'secondsDelayed' => $this->secondsDelayed,
  305. ];
  306. }
  307. }