src/Entity/ChildLessonReview.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ChildLessonReviewRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7. * @ORM\Entity(repositoryClass=ChildLessonReviewRepository::class)
  8. */
  9. class ChildLessonReview
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\GeneratedValue
  14. * @ORM\Column(type="integer")
  15. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  16. */
  17. private $id;
  18. /**
  19. * @ORM\ManyToOne(targetEntity=Child::class, inversedBy="childLessonReviews")
  20. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  21. */
  22. private $child;
  23. /**
  24. * @ORM\ManyToOne(targetEntity=Teacher::class, inversedBy="childLessonReviews")
  25. * @Groups({"ChildLessonReviewList"})
  26. */
  27. private $Teacher;
  28. /**
  29. * @ORM\Column(type="datetime", nullable=true)
  30. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  31. */
  32. private $dateAdd;
  33. /**
  34. * @ORM\ManyToOne(targetEntity=Lesson::class, inversedBy="childLessonReviews")
  35. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  36. */
  37. private $lesson;
  38. /**
  39. * @ORM\Column(type="integer", nullable=true)
  40. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  41. */
  42. private $rating;
  43. /**
  44. * @ORM\Column(type="text", nullable=true)
  45. * @Groups({"ChildLessonReviewList", "TeacherResponsesList"})
  46. */
  47. private $comment;
  48. /**
  49. * @ORM\Column(type="boolean", nullable=true, options={"default": 0})
  50. */
  51. private $isDeleted = false;
  52. /**
  53. * @ORM\Column(type="text", nullable=true)
  54. */
  55. private $deleteReason;
  56. /**
  57. * @ORM\ManyToOne(targetEntity=Admin::class)
  58. * @ORM\JoinColumn(name="deleted_by", referencedColumnName="id", nullable=true)
  59. */
  60. private $deletedBy;
  61. /**
  62. * @ORM\Column(type="datetime", nullable=true)
  63. */
  64. private $deletedAt;
  65. public function getId(): ?int
  66. {
  67. return $this->id;
  68. }
  69. public function getChild(): ?Child
  70. {
  71. return $this->child;
  72. }
  73. public function setChild(?Child $child): self
  74. {
  75. $this->child = $child;
  76. return $this;
  77. }
  78. public function getTeacher(): ?Teacher
  79. {
  80. return $this->Teacher;
  81. }
  82. public function setTeacher(?Teacher $Teacher): self
  83. {
  84. $this->Teacher = $Teacher;
  85. return $this;
  86. }
  87. public function getDateAdd(): ?\DateTimeInterface
  88. {
  89. return $this->dateAdd;
  90. }
  91. public function setDateAdd(?\DateTimeInterface $dateAdd): self
  92. {
  93. $this->dateAdd = $dateAdd;
  94. return $this;
  95. }
  96. public function getLesson(): ?Lesson
  97. {
  98. return $this->lesson;
  99. }
  100. public function setLesson(?Lesson $lesson): self
  101. {
  102. $this->lesson = $lesson;
  103. return $this;
  104. }
  105. public function getRating(): ?int
  106. {
  107. return $this->rating;
  108. }
  109. public function setRating(?int $rating): self
  110. {
  111. $this->rating = $rating;
  112. return $this;
  113. }
  114. public function getComment(): ?string
  115. {
  116. return $this->comment;
  117. }
  118. public function setComment(?string $comment): self
  119. {
  120. $this->comment = $comment;
  121. return $this;
  122. }
  123. public function getIsDeleted(): ?bool
  124. {
  125. return $this->isDeleted;
  126. }
  127. public function setIsDeleted(?bool $isDeleted): self
  128. {
  129. $this->isDeleted = $isDeleted;
  130. return $this;
  131. }
  132. public function getDeleteReason(): ?string
  133. {
  134. return $this->deleteReason;
  135. }
  136. public function setDeleteReason(?string $deleteReason): self
  137. {
  138. $this->deleteReason = $deleteReason;
  139. return $this;
  140. }
  141. public function getDeletedBy(): ?Admin
  142. {
  143. return $this->deletedBy;
  144. }
  145. public function setDeletedBy(?Admin $deletedBy): self
  146. {
  147. $this->deletedBy = $deletedBy;
  148. return $this;
  149. }
  150. public function getDeletedAt(): ?\DateTimeInterface
  151. {
  152. return $this->deletedAt;
  153. }
  154. public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  155. {
  156. $this->deletedAt = $deletedAt;
  157. return $this;
  158. }
  159. public static function getRatingLabel(?int $rating): string
  160. {
  161. return match ($rating) {
  162. 2 => '😞 Labai silpnai',
  163. 4 => '😕 Silpnai',
  164. 8 => '🙂 Gerai',
  165. 10 => '🤩 Puikiai',
  166. default => $rating !== null ? (string) $rating : '',
  167. };
  168. }
  169. }