<?phpnamespace App\Entity;use App\Repository\SuburbRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=SuburbRepository::class) */class Suburb{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToMany(targetEntity=Section::class, mappedBy="suburbs") */ private $sections; /** * @ORM\OneToMany(targetEntity=Person::class, mappedBy="subUrb") */ private $people; public function __construct() { $this->sections = new ArrayCollection(); $this->people = new ArrayCollection(); } 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; } /** * @return Collection<int, Section> */ public function getSections(): Collection { return $this->sections; } public function addSection(Section $section): self { if (!$this->sections->contains($section)) { $this->sections[] = $section; $section->addSuburb($this); } return $this; } public function removeSection(Section $section): self { if ($this->sections->removeElement($section)) { // set the owning side to null (unless already changed) if ($section->getSuburbs()->contains($this)) { $section->getSuburbs()->remove($this); $this->removeSection($section); } } return $this; } /** * @return Collection<int, Person> */ public function getPeople(): Collection { return $this->people; } public function addPerson(Person $person): self { if (!$this->people->contains($person)) { $this->people[] = $person; $person->setSubUrb($this); } return $this; } public function removePerson(Person $person): self { if ($this->people->removeElement($person)) { // set the owning side to null (unless already changed) if ($person->getSubUrb() === $this) { $person->setSubUrb(null); } } return $this; }}