src/Entity/SchoolSection.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SchoolSectionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use App\Entity\Traits\Timestampable;
  9. #[ORM\HasLifecycleCallbacks]
  10. #[ORM\Entity(repositoryClassSchoolSectionRepository::class)]
  11. class SchoolSection
  12. {
  13.     use Timestampable;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\OneToMany(mappedBy'section'targetEntityTheClass::class)]
  21.     private Collection $theClasses;
  22.     #[ORM\ManyToOne(inversedBy'schoolSections'cascade: ["persist"])]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private ?User $author null;
  25.     #[ORM\ManyToOne(inversedBy'schoolSectionsEdited'cascade: ["persist"])]
  26.     private ?User $editor null;
  27.     #[ORM\ManyToOne(inversedBy'schoolSections'cascade: ["persist"])]
  28.     private ?School $school null;
  29.     #[ORM\ManyToOne(inversedBy'sections')]
  30.     private ?CycleLevel $cycleLevel null;
  31.     public function __toString():string
  32.     {
  33.         return $this->name;
  34.     }
  35.     public function __construct()
  36.     {
  37.         $this->theClasses = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): static
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, TheClass>
  54.      */
  55.     public function getTheClasses(): Collection
  56.     {
  57.         return $this->theClasses;
  58.     }
  59.     public function addTheClass(TheClass $theClass): static
  60.     {
  61.         if (!$this->theClasses->contains($theClass)) {
  62.             $this->theClasses->add($theClass);
  63.             $theClass->setSection($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeTheClass(TheClass $theClass): static
  68.     {
  69.         if ($this->theClasses->removeElement($theClass)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($theClass->getSection() === $this) {
  72.                 $theClass->setSection(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }
  77.     public function getAuthor(): ?User
  78.     {
  79.         return $this->author;
  80.     }
  81.     public function setAuthor(?User $author): static
  82.     {
  83.         $this->author $author;
  84.         return $this;
  85.     }
  86.     public function getEditor(): ?User
  87.     {
  88.         return $this->editor;
  89.     }
  90.     public function setEditor(?User $editor): static
  91.     {
  92.         $this->editor $editor;
  93.         return $this;
  94.     }
  95.     
  96.     public function getSchool(): ?School
  97.     {
  98.         return $this->school;
  99.     }
  100.     public function setSchool(?School $school): static
  101.     {
  102.         $this->school $school;
  103.         return $this;
  104.     }
  105.     public function getCycleLevel(): ?CycleLevel
  106.     {
  107.         return $this->cycleLevel;
  108.     }
  109.     public function setCycleLevel(?CycleLevel $cycleLevel): static
  110.     {
  111.         $this->cycleLevel $cycleLevel;
  112.         return $this;
  113.     }
  114. }