src/Entity/Core/Peer/PeerMathproblem.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Peer;
  3. use App\Entity\Core\ImageReference;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JsonSerializable;
  8. #[ORM\Table('peer_mathproblem')]
  9. #[ORM\Entity(repositoryClass: PeerMathproblemRepository::class)]
  10. class PeerMathproblem implements JsonSerializable
  11. {
  12. #[ORM\Column(type: 'integer')]
  13. #[ORM\Id]
  14. #[ORM\GeneratedValue]
  15. private int $id;
  16. #[ORM\JoinColumn(name: 'peer_theme_id')]
  17. #[ORM\ManyToOne(targetEntity: PeerTheme::class, inversedBy: 'peerMathproblems')]
  18. private PeerTheme $peerTheme;
  19. #[ORM\OneToMany(targetEntity: PeerUnit::class, mappedBy: 'peerMathproblem')]
  20. private Collection $peerUnits;
  21. #[ORM\Column(type: 'text')]
  22. private string $title;
  23. #[ORM\Column(type: 'text')]
  24. private string $description;
  25. #[ORM\Column(name: 'student_hint', type: 'text', nullable: true)]
  26. private ?string $studentHint;
  27. #[ORM\Column(name: 'teacher_hint', type: 'text', nullable: true)]
  28. private ?string $teacherHint;
  29. #[ORM\Column(name: 'feedback_stage1', type: 'text', nullable: true)]
  30. private ?string $feedbackStage1;
  31. #[ORM\Column(name: 'feedback_stage2', type: 'text', nullable: true)]
  32. private ?string $feedbackStage2;
  33. #[ORM\Column(name: 'feedback_stage3', type: 'text', nullable: true)]
  34. private ?string $feedbackStage3;
  35. /**
  36. * level 1 = 7th grade, level 2 = 8th grade, level3 = 9+10th grade
  37. */
  38. #[ORM\Column(type: 'integer')]
  39. private int $level;
  40. #[ORM\Column(name: 'student_hint_video', type: 'text', nullable: true)]
  41. private ?string $studentHintVideo;
  42. /**
  43. * The new image layout for CMS and API.
  44. */
  45. #[ORM\JoinColumn(name: 'image_reference', referencedColumnName: 'id', nullable: true)]
  46. #[ORM\OneToOne(targetEntity: ImageReference::class)]
  47. private ?ImageReference $imageReference;
  48. /**
  49. * The new image layout for CMS and API.
  50. */
  51. #[ORM\JoinColumn(name: 'teacher_hint_image_reference', referencedColumnName: 'id', nullable: true)]
  52. #[ORM\OneToOne(targetEntity: ImageReference::class)]
  53. private ?ImageReference $teacherHintImageReference;
  54. /**
  55. * The new image layout for CMS and API.
  56. */
  57. #[ORM\JoinColumn(name: 'student_hint_image_reference', referencedColumnName: 'id', nullable: true)]
  58. #[ORM\OneToOne(targetEntity: ImageReference::class)]
  59. private ?ImageReference $studentHintImageReference;
  60. public function __construct()
  61. {
  62. $this->peerUnits = new ArrayCollection();
  63. $this->imageReference = null;
  64. }
  65. public function getTeacherHintImageReference(): ?ImageReference
  66. {
  67. return $this->teacherHintImageReference;
  68. }
  69. public function setTeacherHintImageReference(?ImageReference $teacherHintImageReference): void
  70. {
  71. $this->teacherHintImageReference = $teacherHintImageReference;
  72. }
  73. public function getStudentHintImageReference(): ?ImageReference
  74. {
  75. return $this->studentHintImageReference;
  76. }
  77. public function setStudentHintImageReference(?ImageReference $studentHintImageReference): void
  78. {
  79. $this->studentHintImageReference = $studentHintImageReference;
  80. }
  81. public function getImageReference(): ?ImageReference
  82. {
  83. return $this->imageReference;
  84. }
  85. public function setImageReference(?ImageReference $imageReference): void
  86. {
  87. $this->imageReference = $imageReference;
  88. }
  89. public function getId(): int
  90. {
  91. return $this->id;
  92. }
  93. public function getPeerTheme(): PeerTheme
  94. {
  95. return $this->peerTheme;
  96. }
  97. public function setPeerTheme(PeerTheme $peerTheme)
  98. {
  99. $this->peerTheme = $peerTheme;
  100. }
  101. public function getDescription(): string
  102. {
  103. return $this->description;
  104. }
  105. public function setDescription(string $description)
  106. {
  107. $this->description = $description;
  108. }
  109. /**
  110. * @return ArrayCollection | PeerUnit[]
  111. */
  112. public function getPeerUnits(): Collection
  113. {
  114. return $this->peerUnits;
  115. }
  116. public function getTitle(): string
  117. {
  118. return $this->title;
  119. }
  120. public function setTitle(string $title): void
  121. {
  122. $this->title = $title;
  123. }
  124. public function getStudentHint(): ?string
  125. {
  126. return $this->studentHint;
  127. }
  128. public function setStudentHint(string $studentHint): void
  129. {
  130. $this->studentHint = $studentHint;
  131. }
  132. public function getTeacherHint(): ?string
  133. {
  134. return $this->teacherHint;
  135. }
  136. public function setTeacherHint(string $teacherHint): void
  137. {
  138. $this->teacherHint = $teacherHint;
  139. }
  140. public function getLevel(): int
  141. {
  142. return $this->level;
  143. }
  144. public function setLevel(int $level): void
  145. {
  146. $this->level = $level;
  147. }
  148. public function jsonSerialize(): mixed
  149. {
  150. return [
  151. "id" => $this->id,
  152. "title" => $this->title,
  153. "description" => $this->description,
  154. "studentHint" => $this->studentHint,
  155. "teacherHint" => $this->teacherHint,
  156. "studentHintVideo" => $this->studentHintVideo,
  157. "level" => $this->level,
  158. ];
  159. }
  160. public function getFeedbackStage1(): ?string
  161. {
  162. return $this->feedbackStage1;
  163. }
  164. public function setFeedbackStage1(?string $feedbackStage1): void
  165. {
  166. $this->feedbackStage1 = $feedbackStage1;
  167. }
  168. public function getFeedbackStage2(): ?string
  169. {
  170. return $this->feedbackStage2;
  171. }
  172. public function setFeedbackStage2(?string $feedbackStage2): void
  173. {
  174. $this->feedbackStage2 = $feedbackStage2;
  175. }
  176. public function getFeedbackStage3(): ?string
  177. {
  178. return $this->feedbackStage3;
  179. }
  180. public function setFeedbackStage3(?string $feedbackStage3): void
  181. {
  182. $this->feedbackStage3 = $feedbackStage3;
  183. }
  184. public function getStudentHintVideo(): ?string
  185. {
  186. return $this->studentHintVideo;
  187. }
  188. public function setStudentHintVideo(?string $studentHintVideo): void
  189. {
  190. $this->studentHintVideo = $studentHintVideo;
  191. }
  192. /** helper functions **/
  193. public function getImagePath(): string
  194. {
  195. return $this->imageReference?->getFullMediaPath() ?? '';
  196. }
  197. public function getStudentHintImagePath(): string
  198. {
  199. return $this->studentHintImageReference?->getFullMediaPath() ?? '';
  200. }
  201. public function getTeacherHintImagePath(): string
  202. {
  203. return $this->teacherHintImageReference?->getFullMediaPath() ?? '';
  204. }
  205. public function getImage(): string {
  206. return $this->getImagePath();
  207. }
  208. public function getStudentHintImage(): string {
  209. return $this->getStudentHintImagePath();
  210. }
  211. public function getTeacherHintImage(): string {
  212. return $this->getTeacherHintImagePath();
  213. }
  214. }