villages = new ArrayCollection(); } public function getCapital(): ?City { return $this->capital; } public function setCapital(City $capital): static { $this->capital = $capital; return $this; } public function getCountry(): ?Country { return $this->country; } public function setCountry(?Country $country): static { $this->country = $country; return $this; } /** * @return Collection */ public function getVillages(): Collection { return $this->villages; } public function addVillage(Village $village): static { if (!$this->villages->contains($village)) { $this->villages->add($village); $village->setPrefecture($this); } return $this; } public function removeVillage(Village $village): static { if ($this->villages->removeElement($village)) { // set the owning side to null (unless already changed) if ($village->getPrefecture() === $this) { $village->setPrefecture(null); } } return $this; } }