src/Entity/TimeRange.php line 13

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