You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
animegame/src/Entity/User.php

83 lines
1.5 KiB

<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
class User
{
private $id;
private $name;
private $password;
private $heroes;
public function __construct()
{
$this->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;
}
}