connection = new ArrayCollection(); $this->connectedPlaces = new ArrayCollection(); } public function getId(): ?int { return $this->id; } /** * @return Collection */ public function getConnection(): Collection { return $this->connection; } public function addConnection(self $connection): self { if (!$this->connection->contains($connection)) { $this->connection[] = $connection; } return $this; } public function removeConnection(self $connection): self { $this->connection->removeElement($connection); return $this; } /** * @return Collection */ public function getConnectedPlaces(): Collection { return $this->connectedPlaces; } public function addConnectedPlace(self $connectedPlace): self { if (!$this->connectedPlaces->contains($connectedPlace)) { $this->connectedPlaces[] = $connectedPlace; $connectedPlace->addConnection($this); } return $this; } public function removeConnectedPlace(self $connectedPlace): self { if ($this->connectedPlaces->removeElement($connectedPlace)) { $connectedPlace->removeConnection($this); } return $this; } }