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