<?phpnamespace App\Entity;use App\Repository\TimeRangeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: TimeRangeRepository::class)]class TimeRange{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(type: Types::TIME_MUTABLE)] private ?\DateTimeInterface $startAt = null; #[ORM\Column(type: Types::TIME_MUTABLE)] private ?\DateTimeInterface $endAt = null; #[ORM\Column] private ?int $position = null; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private ?School $school = null; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private ?SchoolYear $year = null; #[ORM\ManyToMany(targetEntity: AgendaElement::class, mappedBy: 'timeRanges')] private Collection $agendaElements; #[ORM\ManyToMany(targetEntity: Absence::class, inversedBy: 'timeRanges')] private Collection $absences; /** * Entrées du cahier de texte couvrant cette tranche horaire précise. * Côté owning de la relation (comme pour absences) ; LessonLog porte * 'mappedBy' => 'lessonLogs'. */ #[ORM\ManyToMany(targetEntity: LessonLog::class, inversedBy: 'timeRanges')] private Collection $lessonLogs; public function __construct() { $this->agendaElements = new ArrayCollection(); $this->absences = new ArrayCollection(); $this->lessonLogs = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getStartAt(): ?\DateTimeInterface { return $this->startAt; } public function setStartAt(\DateTimeInterface $startAt): static { $this->startAt = $startAt; return $this; } public function getEndAt(): ?\DateTimeInterface { return $this->endAt; } public function setEndAt(\DateTimeInterface $endAt): static { $this->endAt = $endAt; return $this; } public function getPosition(): ?int { return $this->position; } public function setPosition(int $position): static { $this->position = $position; return $this; } public function getSchool(): ?School { return $this->school; } public function setSchool(?School $school): static { $this->school = $school; return $this; } public function getYear(): ?SchoolYear { return $this->year; } public function setYear(?SchoolYear $year): static { $this->year = $year; return $this; } /** * @return Collection<int, AgendaElement> */ public function getAgendaElements(): Collection { return $this->agendaElements; } public function addAgendaElement(AgendaElement $agendaElement): static { if (!$this->agendaElements->contains($agendaElement)) { $this->agendaElements->add($agendaElement); $agendaElement->addTimeRange($this); } return $this; } public function removeAgendaElement(AgendaElement $agendaElement): static { if ($this->agendaElements->removeElement($agendaElement)) { $agendaElement->removeTimeRange($this); } return $this; } /** * @return Collection<int, Absence> */ public function getAbsences(): Collection { return $this->absences; } public function addAbsence(Absence $absence): static { if (!$this->absences->contains($absence)) { $this->absences->add($absence); } return $this; } public function removeAbsence(Absence $absence): static { $this->absences->removeElement($absence); return $this; } /** * @return Collection<int, LessonLog> */ public function getLessonLogs(): Collection { return $this->lessonLogs; } public function addLessonLog(LessonLog $lessonLog): static { if (!$this->lessonLogs->contains($lessonLog)) { $this->lessonLogs->add($lessonLog); } return $this; } public function removeLessonLog(LessonLog $lessonLog): static { $this->lessonLogs->removeElement($lessonLog); return $this; }}