src/Entity/Absence.php line 14

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