Toevoeging van meer responses op messages
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Game\Entity;
|
||||
|
||||
use App\Game\Enum\GameStatus;
|
||||
use App\Game\Repository\GameRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GameRepository::class)]
|
||||
@@ -24,6 +26,18 @@ class Game
|
||||
#[ORM\Column(type: 'string', length: 20, enumType: GameStatus::class)]
|
||||
private ?GameStatus $status = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'game', targetEntity: Session::class)]
|
||||
private Collection $sessions;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'game', targetEntity: GameSetting::class)]
|
||||
private Collection $settings;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->sessions = new ArrayCollection();
|
||||
$this->settings = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -64,4 +78,64 @@ class Game
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Session>
|
||||
*/
|
||||
public function getSessions(): Collection
|
||||
{
|
||||
return $this->sessions;
|
||||
}
|
||||
|
||||
public function addSession(Session $session): static
|
||||
{
|
||||
if (!$this->sessions->contains($session)) {
|
||||
$this->sessions->add($session);
|
||||
$session->setGame($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSession(Session $session): static
|
||||
{
|
||||
if ($this->sessions->removeElement($session)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($session->getGame() === $this) {
|
||||
$session->setGame(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, GameSetting>
|
||||
*/
|
||||
public function getSettings(): Collection
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
public function addSetting(GameSetting $setting): static
|
||||
{
|
||||
if (!$this->settings->contains($setting)) {
|
||||
$this->settings->add($setting);
|
||||
$setting->setGame($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSetting(GameSetting $setting): static
|
||||
{
|
||||
if ($this->settings->removeElement($setting)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($setting->getGame() === $this) {
|
||||
$setting->setGame(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user