src/Entity/Core/BugReport.php line 15

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Core;
  4. use App\Entity\Core\Classroom\ClassroomType;
  5. use DateTime;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use App\Entity\User\User;
  10. #[ORM\Table('bug_report')]
  11. #[ORM\Entity(repositoryClass: BugReportRepository::class)]
  12. class BugReport
  13. {
  14. #[ORM\Column(name: 'id', type: 'integer')]
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue(strategy: 'AUTO')]
  17. private int $id;
  18. #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)]
  19. private ?int $sessionId;
  20. #[ORM\JoinColumn(name: 'mp_id', referencedColumnName: 'id')]
  21. #[ORM\ManyToOne(targetEntity: Mathproblem::class, inversedBy: 'bugReports')]
  22. private Mathproblem $problem;
  23. #[ORM\Column(name: 'mp_error', type: 'boolean', options: ['default' => 0])]
  24. private bool $mpError;
  25. #[ORM\Column(name: 'mp_curriculum', type: 'boolean', options: ['default' => 0])]
  26. private bool $mpCurriculum;
  27. #[ORM\Column(name: 'mp_understanding', type: 'boolean', options: ['default' => 0])]
  28. private bool $mpUnderstanding;
  29. #[ORM\Column(name: 'mp_technical', type: 'boolean', options: ['default' => 0])]
  30. private bool $mpTechnical;
  31. /**
  32. * @var string
  33. */
  34. #[ORM\Column(name: 'message', type: 'string', nullable: true, length: 2000)]
  35. private $message;
  36. #[ORM\Column(name: 'email_address', type: 'string', nullable: true, length: 255)]
  37. private ?string $emailAddress = null;
  38. /**
  39. * @var string
  40. */
  41. #[ORM\Column(name: 'mp_name', type: 'string', nullable: true)]
  42. private string $mpName;
  43. #[ORM\Column(name: 'browser', type: 'string', nullable: true)]
  44. private string $browser;
  45. #[ORM\Column(name: 'timestamp', type: 'datetime', nullable: true)]
  46. private DateTime $timestamp;
  47. #[ORM\Column(name: 'is_teacher', type: 'boolean', nullable: true)]
  48. private ?bool $isTeacher;
  49. #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
  50. #[ORM\ManyToOne(targetEntity: User::class)]
  51. private User $user;
  52. #[ORM\Column(type: 'datetime', nullable: true)]
  53. private DateTime $dateResolved;
  54. /**
  55. * @var Collection<int, ClassroomType>
  56. */
  57. #[ORM\JoinTable(name: 'relation_bug_report_classroom_type')]
  58. #[ORM\JoinColumn(name: 'bug_report_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
  59. #[ORM\InverseJoinColumn(name: 'classroom_type_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
  60. #[ORM\ManyToMany(targetEntity: ClassroomType::class)]
  61. private Collection $classroomTypes;
  62. public function __construct()
  63. {
  64. $this->classroomTypes = new ArrayCollection();
  65. }
  66. public function getId(): int
  67. {
  68. return $this->id;
  69. }
  70. public function getSessionId(): ?int
  71. {
  72. return $this->sessionId;
  73. }
  74. public function setSessionId(int $sessionId): void
  75. {
  76. $this->sessionId = $sessionId;
  77. }
  78. public function getProblem(): Mathproblem
  79. {
  80. return $this->problem;
  81. }
  82. public function setProblem(Mathproblem $problem): void
  83. {
  84. $this->problem = $problem;
  85. }
  86. public function isMpError(): bool
  87. {
  88. return $this->mpError;
  89. }
  90. public function setMpError(bool $mpError): void
  91. {
  92. $this->mpError = $mpError;
  93. }
  94. public function isMpCurriculum(): bool
  95. {
  96. return $this->mpCurriculum;
  97. }
  98. public function setMpCurriculum(bool $mpCurriculum): void
  99. {
  100. $this->mpCurriculum = $mpCurriculum;
  101. }
  102. public function isMpUnderstanding(): bool
  103. {
  104. return $this->mpUnderstanding;
  105. }
  106. public function setMpUnderstanding(bool $mpUnderstanding): void
  107. {
  108. $this->mpUnderstanding = $mpUnderstanding;
  109. }
  110. public function isMpTechnical(): bool
  111. {
  112. return $this->mpTechnical;
  113. }
  114. public function setMpTechnical(bool $mpTechnical): void
  115. {
  116. $this->mpTechnical = $mpTechnical;
  117. }
  118. public function getMessage(): string
  119. {
  120. return $this->message;
  121. }
  122. public function setMessage(string $message): void
  123. {
  124. $this->message = $message;
  125. }
  126. public function getEmailAddress(): ?string
  127. {
  128. return $this->emailAddress;
  129. }
  130. public function setEmailAddress(?string $emailAddress): void
  131. {
  132. $this->emailAddress = $emailAddress;
  133. }
  134. public function getMpName(): string
  135. {
  136. return $this->mpName;
  137. }
  138. public function setMpName($mpName): void
  139. {
  140. $this->mpName = $mpName;
  141. }
  142. public function isTeacher(): ?bool
  143. {
  144. return $this->isTeacher;
  145. }
  146. public function setIsTeacher($isTeacher): void
  147. {
  148. $this->isTeacher = $isTeacher;
  149. }
  150. public function getUser(): User
  151. {
  152. return $this->user;
  153. }
  154. public function setUser(User $user): void
  155. {
  156. $this->user = $user;
  157. }
  158. public function getBrowser(): string
  159. {
  160. return $this->browser;
  161. }
  162. public function setBrowser(string $browser): void
  163. {
  164. $this->browser = $browser;
  165. }
  166. public function getTimestamp(): DateTime
  167. {
  168. return $this->timestamp;
  169. }
  170. public function setTimestamp(DateTime $timestamp): void
  171. {
  172. $this->timestamp = $timestamp;
  173. }
  174. public function getDateResolved(): ?DateTime
  175. {
  176. return $this->dateResolved;
  177. }
  178. public function setDateResolved(DateTime $dateResolved): void
  179. {
  180. $this->dateResolved = $dateResolved;
  181. }
  182. /**
  183. * @return Collection<int, ClassroomType>
  184. */
  185. public function getClassroomTypes(): Collection
  186. {
  187. return $this->classroomTypes;
  188. }
  189. public function addClassroomType(ClassroomType $classroomType): void
  190. {
  191. if (!$this->classroomTypes->contains($classroomType)) {
  192. $this->classroomTypes->add($classroomType);
  193. }
  194. }
  195. public function getClassroomTypeNames(): string
  196. {
  197. return implode(', ', $this->classroomTypes->map(
  198. fn(ClassroomType $ct) => $ct->getDisplayName()
  199. )->toArray());
  200. }
  201. public function getSnippet(): string
  202. {
  203. return $this->problem->getSnippet();
  204. }
  205. public function getTopic(): ?string
  206. {
  207. return $this->problem->getTemplate()->getTopic()->getName();
  208. }
  209. }