<?phpnamespace App\Entity;use App\Repository\TeacherUnavailableRangeRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass=TeacherUnavailableRangeRepository::class) */class TeacherUnavailableRange{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Teacher::class, inversedBy="teacherUnavailableRanges") */ private $teacher; /** * @ORM\Column(type="datetime", nullable=true) * @Groups({"TeacherList"}) */ private $startTime; /** * @ORM\Column(type="datetime", nullable=true) * @Groups({"TeacherList"}) */ private $endTime; /** * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=Admin::class) */ private $createdByAdmin; /** * @ORM\ManyToOne(targetEntity=Admin::class) */ private $deletedByAdmin; /** * @ORM\Column(type="datetime", nullable=true) */ private $deletedAt; /** * @ORM\Column(type="boolean", nullable=true) */ private $isDeleted = 0; public function getId(): ?int { return $this->id; } public function getTeacher(): ?Teacher { return $this->teacher; } public function setTeacher(?Teacher $teacher): self { $this->teacher = $teacher; return $this; } public function getStartTime(): ?\DateTimeInterface { return $this->startTime; } public function setStartTime(?\DateTimeInterface $startTime): self { $this->startTime = $startTime; return $this; } /** * @Groups({"TeacherList"}) */ public function getRemainingDays() { $duration = date_diff(new \DateTime(), $this->endTime); $days = $duration->d; if($days < 0) { $days = 0; } return $days; } public function getEndTime(): ?\DateTimeInterface { return $this->endTime; } public function setEndTime(?\DateTimeInterface $endTime): self { $this->endTime = $endTime; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getCreatedByAdmin(): ?Admin { return $this->createdByAdmin; } public function setCreatedByAdmin(?Admin $createdByAdmin): self { $this->createdByAdmin = $createdByAdmin; return $this; } public function getDeletedByAdmin(): ?Admin { return $this->deletedByAdmin; } public function setDeletedByAdmin(?Admin $deletedByAdmin): self { $this->deletedByAdmin = $deletedByAdmin; return $this; } public function getDeletedAt(): ?\DateTimeInterface { return $this->deletedAt; } public function setDeletedAt(?\DateTimeInterface $deletedAt): self { $this->deletedAt = $deletedAt; return $this; } public function isIsDeleted(): ?bool { return $this->isDeleted; } public function setIsDeleted(?bool $isDeleted): self { $this->isDeleted = $isDeleted; return $this; }}