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.     public function __construct()
  59.     {
  60.         $this->justifyAbsences = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getSubject(): ?Subject
  67.     {
  68.         return $this->subject;
  69.     }
  70.     public function setSubject(?Subject $subject): static
  71.     {
  72.         $this->subject $subject;
  73.         return $this;
  74.     }
  75.     public function getStudent(): ?Student
  76.     {
  77.         return $this->student;
  78.     }
  79.     public function setStudent(?Student $student): static
  80.     {
  81.         $this->student $student;
  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.     public function getStartTime(): ?\DateTimeInterface
  94.     {
  95.         return $this->startTime;
  96.     }
  97.     public function setStartTime(\DateTimeInterface $startTime): static
  98.     {
  99.         $this->startTime $startTime;
  100.         return $this;
  101.     }
  102.     public function getEndTime(): ?\DateTimeInterface
  103.     {
  104.         return $this->endTime;
  105.     }
  106.     public function setEndTime(\DateTimeInterface $endTime): static
  107.     {
  108.         $this->endTime $endTime;
  109.         return $this;
  110.     }
  111.     public function getAbsenceDate(): ?\DateTimeInterface
  112.     {
  113.         return $this->absenceDate;
  114.     }
  115.     public function setAbsenceDate(\DateTimeInterface $absenceDate): static
  116.     {
  117.         $this->absenceDate $absenceDate;
  118.         return $this;
  119.     }
  120.     public function getDuration(): ?int
  121.     {
  122.         return $this->duration;
  123.     }
  124.     public function setDuration(int $duration): static
  125.     {
  126.         $this->duration $duration;
  127.         return $this;
  128.     }
  129.     public function getAuthor(): ?User
  130.     {
  131.         return $this->author;
  132.     }
  133.     public function setAuthor(?User $author): static
  134.     {
  135.         $this->author $author;
  136.         return $this;
  137.     }
  138.     public function getEditor(): ?User
  139.     {
  140.         return $this->editor;
  141.     }
  142.     public function setEditor(?User $editor): static
  143.     {
  144.         $this->editor $editor;
  145.         return $this;
  146.     }
  147.     public function getSchool(): ?School
  148.     {
  149.         return $this->school;
  150.     }
  151.     public function setSchool(?School $school): static
  152.     {
  153.         $this->school $school;
  154.         return $this;
  155.     }
  156.     public function getExam(): ?Exams
  157.     {
  158.         return $this->exam;
  159.     }
  160.     public function setExam(?Exams $exam): static
  161.     {
  162.         $this->exam $exam;
  163.         return $this;
  164.     }
  165.     public function getJustified(): ?int
  166.     {
  167.         return $this->justified;
  168.     }
  169.     public function setJustified(?int $justified): static
  170.     {
  171.         $this->justified $justified;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, JustifyAbsence>
  176.      */
  177.     public function getJustifyAbsences(): Collection
  178.     {
  179.         return $this->justifyAbsences;
  180.     }
  181.     public function addJustifyAbsence(JustifyAbsence $justifyAbsence): static
  182.     {
  183.         if (!$this->justifyAbsences->contains($justifyAbsence)) {
  184.             $this->justifyAbsences->add($justifyAbsence);
  185.             $justifyAbsence->setAbsence($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeJustifyAbsence(JustifyAbsence $justifyAbsence): static
  190.     {
  191.         if ($this->justifyAbsences->removeElement($justifyAbsence)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($justifyAbsence->getAbsence() === $this) {
  194.                 $justifyAbsence->setAbsence(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     public function getClasse(): ?TheClass
  200.     {
  201.         return $this->classe;
  202.     }
  203.     public function setClasse(?TheClass $classe): static
  204.     {
  205.         $this->classe $classe;
  206.         return $this;
  207.     }
  208. }