src/Entity/TeacherUnavailableRange.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TeacherUnavailableRangeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7. * @ORM\Entity(repositoryClass=TeacherUnavailableRangeRepository::class)
  8. */
  9. class TeacherUnavailableRange
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\GeneratedValue
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\ManyToOne(targetEntity=Teacher::class, inversedBy="teacherUnavailableRanges")
  19. */
  20. private $teacher;
  21. /**
  22. * @ORM\Column(type="datetime", nullable=true)
  23. * @Groups({"TeacherList"})
  24. */
  25. private $startTime;
  26. /**
  27. * @ORM\Column(type="datetime", nullable=true)
  28. * @Groups({"TeacherList"})
  29. */
  30. private $endTime;
  31. /**
  32. * @ORM\Column(type="datetime", nullable=true)
  33. */
  34. private $createdAt;
  35. /**
  36. * @ORM\ManyToOne(targetEntity=Admin::class)
  37. */
  38. private $createdByAdmin;
  39. /**
  40. * @ORM\ManyToOne(targetEntity=Admin::class)
  41. */
  42. private $deletedByAdmin;
  43. /**
  44. * @ORM\Column(type="datetime", nullable=true)
  45. */
  46. private $deletedAt;
  47. /**
  48. * @ORM\Column(type="boolean", nullable=true)
  49. */
  50. private $isDeleted = 0;
  51. public function getId(): ?int
  52. {
  53. return $this->id;
  54. }
  55. public function getTeacher(): ?Teacher
  56. {
  57. return $this->teacher;
  58. }
  59. public function setTeacher(?Teacher $teacher): self
  60. {
  61. $this->teacher = $teacher;
  62. return $this;
  63. }
  64. public function getStartTime(): ?\DateTimeInterface
  65. {
  66. return $this->startTime;
  67. }
  68. public function setStartTime(?\DateTimeInterface $startTime): self
  69. {
  70. $this->startTime = $startTime;
  71. return $this;
  72. }
  73. /**
  74. * @Groups({"TeacherList"})
  75. */
  76. public function getRemainingDays()
  77. {
  78. $duration = date_diff(new \DateTime(), $this->endTime);
  79. $days = $duration->d;
  80. if($days < 0)
  81. {
  82. $days = 0;
  83. }
  84. return $days;
  85. }
  86. public function getEndTime(): ?\DateTimeInterface
  87. {
  88. return $this->endTime;
  89. }
  90. public function setEndTime(?\DateTimeInterface $endTime): self
  91. {
  92. $this->endTime = $endTime;
  93. return $this;
  94. }
  95. public function getCreatedAt(): ?\DateTimeInterface
  96. {
  97. return $this->createdAt;
  98. }
  99. public function setCreatedAt(?\DateTimeInterface $createdAt): self
  100. {
  101. $this->createdAt = $createdAt;
  102. return $this;
  103. }
  104. public function getCreatedByAdmin(): ?Admin
  105. {
  106. return $this->createdByAdmin;
  107. }
  108. public function setCreatedByAdmin(?Admin $createdByAdmin): self
  109. {
  110. $this->createdByAdmin = $createdByAdmin;
  111. return $this;
  112. }
  113. public function getDeletedByAdmin(): ?Admin
  114. {
  115. return $this->deletedByAdmin;
  116. }
  117. public function setDeletedByAdmin(?Admin $deletedByAdmin): self
  118. {
  119. $this->deletedByAdmin = $deletedByAdmin;
  120. return $this;
  121. }
  122. public function getDeletedAt(): ?\DateTimeInterface
  123. {
  124. return $this->deletedAt;
  125. }
  126. public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  127. {
  128. $this->deletedAt = $deletedAt;
  129. return $this;
  130. }
  131. public function isIsDeleted(): ?bool
  132. {
  133. return $this->isDeleted;
  134. }
  135. public function setIsDeleted(?bool $isDeleted): self
  136. {
  137. $this->isDeleted = $isDeleted;
  138. return $this;
  139. }
  140. }