src/Entity/Absence.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\AbsenceRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\HasLifecycleCallbacks]
  11. #[ORM\Entity(repositoryClassAbsenceRepository::class)]
  12. class Absence
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['getAbsence'])]
  19.     private ?int $id null;
  20.     #[ORM\ManyToOne(inversedBy'absences'cascade: ["persist"])]
  21.     #[Groups(['getAbsence'])]
  22.     private ?Subject $subject null;
  23.     #[ORM\ManyToOne(inversedBy'absences'cascade: ["persist"])]
  24.     #[Groups(['getAbsence'])]
  25.     private ?Student $student null;
  26.     #[ORM\ManyToOne(inversedBy'absences'cascade: ["persist"])]
  27.     private ?SchoolYear $year null;
  28.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  29.     #[Groups(['getAbsence'])]
  30.     private ?\DateTimeInterface $startTime null;
  31.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  32.     #[Groups(['getAbsence'])]
  33.     private ?\DateTimeInterface $endTime null;
  34.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  35.     #[Groups(['getAbsence'])]
  36.     private ?\DateTimeInterface $absenceDate null;
  37.     #[ORM\Column]
  38.     #[Groups(['getAbsence'])]
  39.     private ?int $duration null;
  40.     #[ORM\ManyToOne(inversedBy'absences'cascade: ["persist"])]
  41.     private ?User $author null;
  42.     #[ORM\ManyToOne(inversedBy'absencesEdited'cascade: ["persist"])]
  43.     private ?User $editor null;
  44.     #[ORM\ManyToOne(inversedBy'absences')]
  45.     private ?School $school null;
  46.     #[ORM\ManyToOne(inversedBy'absences'cascade: ["persist"])]
  47.     #[ORM\JoinColumn(nullablefalse)]
  48.     #[Groups(['getAbsence'])]
  49.     private ?Exams $exam null;
  50.     #[ORM\Column(nullabletrue)]
  51.     #[Groups(['getAbsence'])]
  52.     private ?int $justified null;
  53.     #[ORM\OneToMany(mappedBy'absence'targetEntityJustifyAbsence::class)]
  54.     private Collection $justifyAbsences;
  55.     #[ORM\ManyToOne(inversedBy'absences')]
  56.     #[Groups(['getAbsence'])]
  57.     private ?TheClass $classe null;
  58.     #[ORM\ManyToMany(targetEntityTimeRange::class, mappedBy'absences')]
  59.     private Collection $timeRanges;
  60.     #[ORM\ManyToOne(inversedBy'absences')]
  61.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  62.     private ?AgendaElement $agendaElement null;
  63.     public function __construct()
  64.     {
  65.         $this->justifyAbsences = new ArrayCollection();
  66.         $this->timeRanges = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getSubject(): ?Subject
  73.     {
  74.         return $this->subject;
  75.     }
  76.     public function setSubject(?Subject $subject): static
  77.     {
  78.         $this->subject $subject;
  79.         return $this;
  80.     }
  81.     public function getStudent(): ?Student
  82.     {
  83.         return $this->student;
  84.     }
  85.     public function setStudent(?Student $student): static
  86.     {
  87.         $this->student $student;
  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.     public function getStartTime(): ?\DateTimeInterface
  100.     {
  101.         return $this->startTime;
  102.     }
  103.     public function setStartTime(\DateTimeInterface $startTime): static
  104.     {
  105.         $this->startTime $startTime;
  106.         return $this;
  107.     }
  108.     public function getEndTime(): ?\DateTimeInterface
  109.     {
  110.         return $this->endTime;
  111.     }
  112.     public function setEndTime(\DateTimeInterface $endTime): static
  113.     {
  114.         $this->endTime $endTime;
  115.         return $this;
  116.     }
  117.     public function getAbsenceDate(): ?\DateTimeInterface
  118.     {
  119.         return $this->absenceDate;
  120.     }
  121.     public function setAbsenceDate(\DateTimeInterface $absenceDate): static
  122.     {
  123.         $this->absenceDate $absenceDate;
  124.         return $this;
  125.     }
  126.     public function getDuration(): ?int
  127.     {
  128.         return $this->duration;
  129.     }
  130.     public function setDuration(int $duration): static
  131.     {
  132.         $this->duration $duration;
  133.         return $this;
  134.     }
  135.     public function getAuthor(): ?User
  136.     {
  137.         return $this->author;
  138.     }
  139.     public function setAuthor(?User $author): static
  140.     {
  141.         $this->author $author;
  142.         return $this;
  143.     }
  144.     public function getEditor(): ?User
  145.     {
  146.         return $this->editor;
  147.     }
  148.     public function setEditor(?User $editor): static
  149.     {
  150.         $this->editor $editor;
  151.         return $this;
  152.     }
  153.     public function getSchool(): ?School
  154.     {
  155.         return $this->school;
  156.     }
  157.     public function setSchool(?School $school): static
  158.     {
  159.         $this->school $school;
  160.         return $this;
  161.     }
  162.     public function getExam(): ?Exams
  163.     {
  164.         return $this->exam;
  165.     }
  166.     public function setExam(?Exams $exam): static
  167.     {
  168.         $this->exam $exam;
  169.         return $this;
  170.     }
  171.     public function getJustified(): ?int
  172.     {
  173.         return $this->justified;
  174.     }
  175.     public function setJustified(?int $justified): static
  176.     {
  177.         $this->justified $justified;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, JustifyAbsence>
  182.      */
  183.     public function getJustifyAbsences(): Collection
  184.     {
  185.         return $this->justifyAbsences;
  186.     }
  187.     public function addJustifyAbsence(JustifyAbsence $justifyAbsence): static
  188.     {
  189.         if (!$this->justifyAbsences->contains($justifyAbsence)) {
  190.             $this->justifyAbsences->add($justifyAbsence);
  191.             $justifyAbsence->setAbsence($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeJustifyAbsence(JustifyAbsence $justifyAbsence): static
  196.     {
  197.         if ($this->justifyAbsences->removeElement($justifyAbsence)) {
  198.             // set the owning side to null (unless already changed)
  199.             if ($justifyAbsence->getAbsence() === $this) {
  200.                 $justifyAbsence->setAbsence(null);
  201.             }
  202.         }
  203.         return $this;
  204.     }
  205.     public function getClasse(): ?TheClass
  206.     {
  207.         return $this->classe;
  208.     }
  209.     public function setClasse(?TheClass $classe): static
  210.     {
  211.         $this->classe $classe;
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return Collection<int, TimeRange>
  216.      */
  217.     public function getTimeRanges(): Collection
  218.     {
  219.         return $this->timeRanges;
  220.     }
  221.     public function addTimeRange(TimeRange $timeRange): static
  222.     {
  223.         if (!$this->timeRanges->contains($timeRange)) {
  224.             $this->timeRanges->add($timeRange);
  225.             $timeRange->addAbsence($this);
  226.         }
  227.         return $this;
  228.     }
  229.     public function removeTimeRange(TimeRange $timeRange): static
  230.     {
  231.         if ($this->timeRanges->removeElement($timeRange)) {
  232.             $timeRange->removeAbsence($this);
  233.         }
  234.         return $this;
  235.     }
  236.     public function getAgendaElement(): ?AgendaElement
  237.     {
  238.         return $this->agendaElement;
  239.     }
  240.     public function setAgendaElement(?AgendaElement $agendaElement): static
  241.     {
  242.         $this->agendaElement $agendaElement;
  243.         return $this;
  244.     }
  245. }