src/Entity/CycleLevel.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CycleLevelRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCycleLevelRepository::class)]
  8. class CycleLevel
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\Column]
  17.     private ?int $level null;
  18.     #[ORM\OneToMany(mappedBy'cycle'targetEntityClassLevel::class)]
  19.     private Collection $classLevels;
  20.     #[ORM\OneToMany(mappedBy'cycleLevel'targetEntitySchoolSection::class)]
  21.     private Collection $sections;
  22.     public function __construct()
  23.     {
  24.         $this->classLevels = new ArrayCollection();
  25.         $this->sections = new ArrayCollection();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function __toString(): string
  32.     {
  33.         return $this->name;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): static
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function getLevel(): ?int
  45.     {
  46.         return $this->level;
  47.     }
  48.     public function setLevel(int $level): static
  49.     {
  50.         $this->level $level;
  51.         return $this;
  52.     }
  53.     /**
  54.      * @return Collection<int, ClassLevel>
  55.      */
  56.     public function getClassLevels(): Collection
  57.     {
  58.         return $this->classLevels;
  59.     }
  60.     public function addClassLevel(ClassLevel $classLevel): static
  61.     {
  62.         if (!$this->classLevels->contains($classLevel)) {
  63.             $this->classLevels->add($classLevel);
  64.             $classLevel->setCycle($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeClassLevel(ClassLevel $classLevel): static
  69.     {
  70.         if ($this->classLevels->removeElement($classLevel)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($classLevel->getCycle() === $this) {
  73.                 $classLevel->setCycle(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Collection<int, SchoolSection>
  80.      */
  81.     public function getSections(): Collection
  82.     {
  83.         return $this->sections;
  84.     }
  85.     public function addSection(SchoolSection $section): static
  86.     {
  87.         if (!$this->sections->contains($section)) {
  88.             $this->sections->add($section);
  89.             $section->setCycleLevel($this);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeSection(SchoolSection $section): static
  94.     {
  95.         if ($this->sections->removeElement($section)) {
  96.             // set the owning side to null (unless already changed)
  97.             if ($section->getCycleLevel() === $this) {
  98.                 $section->setCycleLevel(null);
  99.             }
  100.         }
  101.         return $this;
  102.     }
  103. }