src/Entity/School.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SchoolRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SchoolRepository::class)
  9.  */
  10. class School
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $address;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $phone;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $email;
  34.     /**
  35.      * @ORM\Column(type="datetime_immutable")
  36.      */
  37.     private $createdAt;
  38.     /**
  39.      * @ORM\Column(type="datetime_immutable", nullable=true)
  40.      */
  41.     private $updatedAt;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=Promotion::class, mappedBy="school")
  44.      */
  45.     private $promotions;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=Student::class, mappedBy="school")
  48.      */
  49.     private $students;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity=Teacher::class, mappedBy="school")
  52.      */
  53.     private $teachers;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="school")
  56.      */
  57.     private $users;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=Fee::class, mappedBy="school")
  60.      */
  61.     private $fees;
  62.     public function __construct()
  63.     {
  64.         $this->promotions = new ArrayCollection();
  65.         $this->students = new ArrayCollection();
  66.         $this->teachers = new ArrayCollection();
  67.         $this->users = new ArrayCollection();
  68.         $this->fees = new ArrayCollection();
  69.     }
  70.     public function __toString(): string
  71.     {
  72.         return $this->name;
  73.     }
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(string $name): self
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getAddress(): ?string
  88.     {
  89.         return $this->address;
  90.     }
  91.     public function setAddress(?string $address): self
  92.     {
  93.         $this->address $address;
  94.         return $this;
  95.     }
  96.     public function getPhone(): ?string
  97.     {
  98.         return $this->phone;
  99.     }
  100.     public function setPhone(?string $phone): self
  101.     {
  102.         $this->phone $phone;
  103.         return $this;
  104.     }
  105.     public function getEmail(): ?string
  106.     {
  107.         return $this->email;
  108.     }
  109.     public function setEmail(?string $email): self
  110.     {
  111.         $this->email $email;
  112.         return $this;
  113.     }
  114.     public function getCreatedAt(): ?\DateTimeImmutable
  115.     {
  116.         return $this->createdAt;
  117.     }
  118.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  119.     {
  120.         $this->createdAt $createdAt;
  121.         return $this;
  122.     }
  123.     public function getUpdatedAt(): ?\DateTimeImmutable
  124.     {
  125.         return $this->updatedAt;
  126.     }
  127.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  128.     {
  129.         $this->updatedAt $updatedAt;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, Promotion>
  134.      */
  135.     public function getPromotions(): Collection
  136.     {
  137.         return $this->promotions;
  138.     }
  139.     public function addPromotion(Promotion $promotion): self
  140.     {
  141.         if (!$this->promotions->contains($promotion)) {
  142.             $this->promotions->add($promotion);
  143.             $promotion->setSchool($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removePromotion(Promotion $promotion): self
  148.     {
  149.         if ($this->promotions->removeElement($promotion)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($promotion->getSchool() === $this) {
  152.                 $promotion->setSchool(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, Student>
  159.      */
  160.     public function getStudents(): Collection
  161.     {
  162.         return $this->students;
  163.     }
  164.     public function addStudent(Student $student): self
  165.     {
  166.         if (!$this->students->contains($student)) {
  167.             $this->students->add($student);
  168.             $student->setSchool($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeStudent(Student $student): self
  173.     {
  174.         if ($this->students->removeElement($student)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($student->getSchool() === $this) {
  177.                 $student->setSchool(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     /**
  183.      * @return Collection<int, Teacher>
  184.      */
  185.     public function getTeachers(): Collection
  186.     {
  187.         return $this->teachers;
  188.     }
  189.     public function addTeacher(Teacher $teacher): self
  190.     {
  191.         if (!$this->teachers->contains($teacher)) {
  192.             $this->teachers->add($teacher);
  193.             $teacher->setSchool($this);
  194.         }
  195.         return $this;
  196.     }
  197.     public function removeTeacher(Teacher $teacher): self
  198.     {
  199.         if ($this->teachers->removeElement($teacher)) {
  200.             // set the owning side to null (unless already changed)
  201.             if ($teacher->getSchool() === $this) {
  202.                 $teacher->setSchool(null);
  203.             }
  204.         }
  205.         return $this;
  206.     }
  207.     /**
  208.      * @return Collection<int, User>
  209.      */
  210.     public function getUsers(): Collection
  211.     {
  212.         return $this->users;
  213.     }
  214.     public function addUser(User $user): self
  215.     {
  216.         if (!$this->users->contains($user)) {
  217.             $this->users->add($user);
  218.             $user->setSchool($this);
  219.         }
  220.         return $this;
  221.     }
  222.     public function removeUser(User $user): self
  223.     {
  224.         if ($this->users->removeElement($user)) {
  225.             // set the owning side to null (unless already changed)
  226.             if ($user->getSchool() === $this) {
  227.                 $user->setSchool(null);
  228.             }
  229.         }
  230.         return $this;
  231.     }
  232.     /**
  233.      * @return Collection<int, Fee>
  234.      */
  235.     public function getFees(): Collection
  236.     {
  237.         return $this->fees;
  238.     }
  239.     public function addFee(Fee $fee): self
  240.     {
  241.         if (!$this->fees->contains($fee)) {
  242.             $this->fees->add($fee);
  243.             $fee->setSchool($this);
  244.         }
  245.         return $this;
  246.     }
  247.     public function removeFee(Fee $fee): self
  248.     {
  249.         if ($this->fees->removeElement($fee)) {
  250.             // set the owning side to null (unless already changed)
  251.             if ($fee->getSchool() === $this) {
  252.                 $fee->setSchool(null);
  253.             }
  254.         }
  255.         return $this;
  256.     }