src/CoreBundle/Entity/PretestResponse.php line 14

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