<?phpnamespace App\Entity;use App\Entity\Traits\Timestampable;use App\Repository\AbsenceRepository;use Doctrine\DBAL\Types\Types;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use JMS\Serializer\Annotation\Groups;#[ORM\HasLifecycleCallbacks]#[ORM\Entity(repositoryClass: AbsenceRepository::class)]class Absence{ use Timestampable; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['getAbsence'])] private ?int $id = null; #[ORM\ManyToOne(inversedBy: 'absences', cascade: ["persist"])] #[Groups(['getAbsence'])] private ?Subject $subject = null; #[ORM\ManyToOne(inversedBy: 'absences', cascade: ["persist"])] #[Groups(['getAbsence'])] private ?Student $student = null; #[ORM\ManyToOne(inversedBy: 'absences', cascade: ["persist"])] private ?SchoolYear $year = null; #[ORM\Column(type: Types::TIME_MUTABLE)] #[Groups(['getAbsence'])] private ?\DateTimeInterface $startTime = null; #[ORM\Column(type: Types::TIME_MUTABLE)] #[Groups(['getAbsence'])] private ?\DateTimeInterface $endTime = null; #[ORM\Column(type: Types::DATE_MUTABLE)] #[Groups(['getAbsence'])] private ?\DateTimeInterface $absenceDate = null; #[ORM\Column] #[Groups(['getAbsence'])] private ?int $duration = null; #[ORM\ManyToOne(inversedBy: 'absences', cascade: ["persist"])] private ?User $author = null; #[ORM\ManyToOne(inversedBy: 'absencesEdited', cascade: ["persist"])] private ?User $editor = null; #[ORM\ManyToOne(inversedBy: 'absences')] private ?School $school = null; #[ORM\ManyToOne(inversedBy: 'absences', cascade: ["persist"])] #[ORM\JoinColumn(nullable: false)] #[Groups(['getAbsence'])] private ?Exams $exam = null; #[ORM\Column(nullable: true)] #[Groups(['getAbsence'])] private ?int $justified = null; #[ORM\OneToMany(mappedBy: 'absence', targetEntity: JustifyAbsence::class)] private Collection $justifyAbsences; #[ORM\ManyToOne(inversedBy: 'absences')] #[Groups(['getAbsence'])] private ?TheClass $classe = null; public function __construct() { $this->justifyAbsences = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getSubject(): ?Subject { return $this->subject; } public function setSubject(?Subject $subject): static { $this->subject = $subject; return $this; } public function getStudent(): ?Student { return $this->student; } public function setStudent(?Student $student): static { $this->student = $student; return $this; } public function getYear(): ?SchoolYear { return $this->year; } public function setYear(?SchoolYear $year): static { $this->year = $year; return $this; } public function getStartTime(): ?\DateTimeInterface { return $this->startTime; } public function setStartTime(\DateTimeInterface $startTime): static { $this->startTime = $startTime; return $this; } public function getEndTime(): ?\DateTimeInterface { return $this->endTime; } public function setEndTime(\DateTimeInterface $endTime): static { $this->endTime = $endTime; return $this; } public function getAbsenceDate(): ?\DateTimeInterface { return $this->absenceDate; } public function setAbsenceDate(\DateTimeInterface $absenceDate): static { $this->absenceDate = $absenceDate; return $this; } public function getDuration(): ?int { return $this->duration; } public function setDuration(int $duration): static { $this->duration = $duration; return $this; } public function getAuthor(): ?User { return $this->author; } public function setAuthor(?User $author): static { $this->author = $author; return $this; } public function getEditor(): ?User { return $this->editor; } public function setEditor(?User $editor): static { $this->editor = $editor; return $this; } public function getSchool(): ?School { return $this->school; } public function setSchool(?School $school): static { $this->school = $school; return $this; } public function getExam(): ?Exams { return $this->exam; } public function setExam(?Exams $exam): static { $this->exam = $exam; return $this; } public function getJustified(): ?int { return $this->justified; } public function setJustified(?int $justified): static { $this->justified = $justified; return $this; } /** * @return Collection<int, JustifyAbsence> */ public function getJustifyAbsences(): Collection { return $this->justifyAbsences; } public function addJustifyAbsence(JustifyAbsence $justifyAbsence): static { if (!$this->justifyAbsences->contains($justifyAbsence)) { $this->justifyAbsences->add($justifyAbsence); $justifyAbsence->setAbsence($this); } return $this; } public function removeJustifyAbsence(JustifyAbsence $justifyAbsence): static { if ($this->justifyAbsences->removeElement($justifyAbsence)) { // set the owning side to null (unless already changed) if ($justifyAbsence->getAbsence() === $this) { $justifyAbsence->setAbsence(null); } } return $this; } public function getClasse(): ?TheClass { return $this->classe; } public function setClasse(?TheClass $classe): static { $this->classe = $classe; return $this; }}