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