<?php
namespace App\Entity;
use App\Repository\SchoolRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @ORM\Entity(repositoryClass=SchoolRepository::class)
*/
class School
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $updatedAt;
/**
* @ORM\OneToMany(targetEntity=Promotion::class, mappedBy="school")
*/
private $promotions;
/**
* @ORM\OneToMany(targetEntity=Student::class, mappedBy="school")
*/
private $students;
/**
* @ORM\OneToMany(targetEntity=Teacher::class, mappedBy="school")
*/
private $teachers;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="school")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=Fee::class, mappedBy="school")
*/
private $fees;
public function __construct()
{
$this->promotions = new ArrayCollection();
$this->students = new ArrayCollection();
$this->teachers = new ArrayCollection();
$this->users = new ArrayCollection();
$this->fees = new ArrayCollection();
}
public function __toString(): string
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection<int, Promotion>
*/
public function getPromotions(): Collection
{
return $this->promotions;
}
public function addPromotion(Promotion $promotion): self
{
if (!$this->promotions->contains($promotion)) {
$this->promotions->add($promotion);
$promotion->setSchool($this);
}
return $this;
}
public function removePromotion(Promotion $promotion): self
{
if ($this->promotions->removeElement($promotion)) {
// set the owning side to null (unless already changed)
if ($promotion->getSchool() === $this) {
$promotion->setSchool(null);
}
}
return $this;
}
/**
* @return Collection<int, Student>
*/
public function getStudents(): Collection
{
return $this->students;
}
public function addStudent(Student $student): self
{
if (!$this->students->contains($student)) {
$this->students->add($student);
$student->setSchool($this);
}
return $this;
}
public function removeStudent(Student $student): self
{
if ($this->students->removeElement($student)) {
// set the owning side to null (unless already changed)
if ($student->getSchool() === $this) {
$student->setSchool(null);
}
}
return $this;
}
/**
* @return Collection<int, Teacher>
*/
public function getTeachers(): Collection
{
return $this->teachers;
}
public function addTeacher(Teacher $teacher): self
{
if (!$this->teachers->contains($teacher)) {
$this->teachers->add($teacher);
$teacher->setSchool($this);
}
return $this;
}
public function removeTeacher(Teacher $teacher): self
{
if ($this->teachers->removeElement($teacher)) {
// set the owning side to null (unless already changed)
if ($teacher->getSchool() === $this) {
$teacher->setSchool(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setSchool($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getSchool() === $this) {
$user->setSchool(null);
}
}
return $this;
}
/**
* @return Collection<int, Fee>
*/
public function getFees(): Collection
{
return $this->fees;
}
public function addFee(Fee $fee): self
{
if (!$this->fees->contains($fee)) {
$this->fees->add($fee);
$fee->setSchool($this);
}
return $this;
}
public function removeFee(Fee $fee): self
{
if ($this->fees->removeElement($fee)) {
// set the owning side to null (unless already changed)
if ($fee->getSchool() === $this) {
$fee->setSchool(null);
}
}
return $this;
}
}