heroes = 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; } public function getPassword(): ?string { return $this->password; } public function setPassword(string $password): self { $this->password = $password; return $this; } /** * @return Collection|Hero[] */ public function getHeroes(): Collection { return $this->heroes; } public function addHero(Hero $hero): self { if (!$this->heroes->contains($hero)) { $this->heroes[] = $hero; $hero->setUser($this); } return $this; } public function removeHero(Hero $hero): self { if ($this->heroes->contains($hero)) { $this->heroes->removeElement($hero); // set the owning side to null (unless already changed) if ($hero->getUser() === $this) { $hero->setUser(null); } } return $this; } }