<?phpnamespace App\Entity;use App\Repository\RegionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RegionRepository::class)]class Region{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(length: 255)] private ?string $nameEn = null; #[ORM\OneToMany(mappedBy: 'region', targetEntity: Department::class)] private Collection $departments; #[ORM\OneToMany(mappedBy: 'region', targetEntity: School::class)] private Collection $schools; #[ORM\OneToMany(mappedBy: 'regionInspect', targetEntity: User::class)] private Collection $users; public function __construct() { $this->departments = new ArrayCollection(); $this->schools = new ArrayCollection(); $this->users = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getNameEn(): ?string { return $this->nameEn; } public function setNameEn(string $nameEn): static { $this->nameEn = $nameEn; return $this; } /** * @return Collection<int, Department> */ public function getDepartments(): Collection { return $this->departments; } public function addDepartment(Department $department): static { if (!$this->departments->contains($department)) { $this->departments->add($department); $department->setRegion($this); } return $this; } public function removeDepartment(Department $department): static { if ($this->departments->removeElement($department)) { // set the owning side to null (unless already changed) if ($department->getRegion() === $this) { $department->setRegion(null); } } return $this; } /** * @return Collection<int, School> */ public function getSchools(): Collection { return $this->schools; } public function addSchool(School $school): static { if (!$this->schools->contains($school)) { $this->schools->add($school); $school->setRegion($this); } return $this; } public function removeSchool(School $school): static { if ($this->schools->removeElement($school)) { // set the owning side to null (unless already changed) if ($school->getRegion() === $this) { $school->setRegion(null); } } return $this; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): static { if (!$this->users->contains($user)) { $this->users->add($user); $user->setRegionInspect($this); } return $this; } public function removeUser(User $user): static { if ($this->users->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getRegionInspect() === $this) { $user->setRegionInspect(null); } } return $this; }}