<?phpnamespace App\Entity;use App\Repository\DepartmentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: DepartmentRepository::class)]class Department{ #[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\ManyToOne(inversedBy: 'departments')] #[ORM\JoinColumn(nullable: false)] private ?Region $region = null; #[ORM\OneToMany(mappedBy: 'department', targetEntity: School::class)] private Collection $schools; #[ORM\OneToMany(mappedBy: 'departmentInspect', targetEntity: User::class)] private Collection $users; public function __construct() { $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; } public function getRegion(): ?Region { return $this->region; } public function setRegion(?Region $region): static { $this->region = $region; 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->setDepartment($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->getDepartment() === $this) { $school->setDepartment(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->setDepartmentInspect($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->getDepartmentInspect() === $this) { $user->setDepartmentInspect(null); } } return $this; }}