src/Entity/TimeTableClass.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\TimeTableClassRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassTimeTableClassRepository::class)]
  11. #[ORM\HasLifecycleCallbacks]
  12. class TimeTableClass
  13. {
  14.    use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['getTimetable'])]
  19.     private ?int $id null;
  20.     #[Groups(['getTimetable'])]
  21.     #[ORM\Column(length255)]
  22.     private ?string $name null;
  23.     #[ORM\ManyToOne(inversedBy'timeTableClasses')]
  24.     private ?TheClass $classe null;
  25.     #[ORM\ManyToOne(inversedBy'timeTableClasses')]
  26.     private ?SchoolYear $year null;
  27.     #[ORM\OneToMany(mappedBy'parent'targetEntityExamTimeTable::class)]
  28.     private Collection $examTimeTables;
  29.     public function __construct()
  30.     {
  31.         $this->examTimeTables = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(string $name): static
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getClasse(): ?TheClass
  47.     {
  48.         return $this->classe;
  49.     }
  50.     public function setClasse(?TheClass $classe): static
  51.     {
  52.         $this->classe $classe;
  53.         return $this;
  54.     }
  55.     public function getYear(): ?SchoolYear
  56.     {
  57.         return $this->year;
  58.     }
  59.     public function setYear(?SchoolYear $year): static
  60.     {
  61.         $this->year $year;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection<int, ExamTimeTable>
  66.      */
  67.     public function getExamTimeTables(): Collection
  68.     {
  69.         return $this->examTimeTables;
  70.     }
  71.     public function addExamTimeTable(ExamTimeTable $examTimeTable): static
  72.     {
  73.         if (!$this->examTimeTables->contains($examTimeTable)) {
  74.             $this->examTimeTables->add($examTimeTable);
  75.             $examTimeTable->setParent($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeExamTimeTable(ExamTimeTable $examTimeTable): static
  80.     {
  81.         if ($this->examTimeTables->removeElement($examTimeTable)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($examTimeTable->getParent() === $this) {
  84.                 $examTimeTable->setParent(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89. }