src/Entity/TimeRange.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TimeRangeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassTimeRangeRepository::class)]
  9. class TimeRange
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  16.     private ?\DateTimeInterface $startAt null;
  17.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  18.     private ?\DateTimeInterface $endAt null;
  19.     #[ORM\Column]
  20.     private ?int $position null;
  21.     #[ORM\ManyToOne]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private ?School $school null;
  24.     #[ORM\ManyToOne]
  25.     #[ORM\JoinColumn(nullablefalse)]
  26.     private ?SchoolYear $year null;
  27.     #[ORM\ManyToMany(targetEntityAgendaElement::class, mappedBy'timeRanges')]
  28.     private Collection $agendaElements;
  29.     #[ORM\ManyToMany(targetEntityAbsence::class, inversedBy'timeRanges')]
  30.     private Collection $absences;
  31.     /**
  32.      * Entrées du cahier de texte couvrant cette tranche horaire précise.
  33.      * Côté owning de la relation (comme pour absences) ; LessonLog porte
  34.      * 'mappedBy' => 'lessonLogs'.
  35.      */
  36.     #[ORM\ManyToMany(targetEntityLessonLog::class, inversedBy'timeRanges')]
  37.     private Collection $lessonLogs;
  38.     public function __construct()
  39.     {
  40.         $this->agendaElements = new ArrayCollection();
  41.         $this->absences = new ArrayCollection();
  42.         $this->lessonLogs = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getStartAt(): ?\DateTimeInterface
  49.     {
  50.         return $this->startAt;
  51.     }
  52.     public function setStartAt(\DateTimeInterface $startAt): static
  53.     {
  54.         $this->startAt $startAt;
  55.         return $this;
  56.     }
  57.     public function getEndAt(): ?\DateTimeInterface
  58.     {
  59.         return $this->endAt;
  60.     }
  61.     public function setEndAt(\DateTimeInterface $endAt): static
  62.     {
  63.         $this->endAt $endAt;
  64.         return $this;
  65.     }
  66.     public function getPosition(): ?int
  67.     {
  68.         return $this->position;
  69.     }
  70.     public function setPosition(int $position): static
  71.     {
  72.         $this->position $position;
  73.         return $this;
  74.     }
  75.     public function getSchool(): ?School
  76.     {
  77.         return $this->school;
  78.     }
  79.     public function setSchool(?School $school): static
  80.     {
  81.         $this->school $school;
  82.         return $this;
  83.     }
  84.     public function getYear(): ?SchoolYear
  85.     {
  86.         return $this->year;
  87.     }
  88.     public function setYear(?SchoolYear $year): static
  89.     {
  90.         $this->year $year;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection<int, AgendaElement>
  95.      */
  96.     public function getAgendaElements(): Collection
  97.     {
  98.         return $this->agendaElements;
  99.     }
  100.     public function addAgendaElement(AgendaElement $agendaElement): static
  101.     {
  102.         if (!$this->agendaElements->contains($agendaElement)) {
  103.             $this->agendaElements->add($agendaElement);
  104.             $agendaElement->addTimeRange($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeAgendaElement(AgendaElement $agendaElement): static
  109.     {
  110.         if ($this->agendaElements->removeElement($agendaElement)) {
  111.             $agendaElement->removeTimeRange($this);
  112.         }
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return Collection<int, Absence>
  117.      */
  118.     public function getAbsences(): Collection
  119.     {
  120.         return $this->absences;
  121.     }
  122.     public function addAbsence(Absence $absence): static
  123.     {
  124.         if (!$this->absences->contains($absence)) {
  125.             $this->absences->add($absence);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeAbsence(Absence $absence): static
  130.     {
  131.         $this->absences->removeElement($absence);
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return Collection<int, LessonLog>
  136.      */
  137.     public function getLessonLogs(): Collection
  138.     {
  139.         return $this->lessonLogs;
  140.     }
  141.     public function addLessonLog(LessonLog $lessonLog): static
  142.     {
  143.         if (!$this->lessonLogs->contains($lessonLog)) {
  144.             $this->lessonLogs->add($lessonLog);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeLessonLog(LessonLog $lessonLog): static
  149.     {
  150.         $this->lessonLogs->removeElement($lessonLog);
  151.         return $this;
  152.     }
  153. }