<?php
namespace App\Entity;
use App\Repository\ATPProgramCourtRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\Ignore;
/**
* @ORM\Entity(repositoryClass=ATPProgramCourtRepository::class)
*/
class ATPProgramCourt
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups( "atpprogram:list", "atpprogram:item")
*/
private $id;
/**
* @ORM\Column(type="time", nullable=true)
* @Groups( "atpprogram:list", "atpprogram:item")
*/
private $displayTime;
/**
* @ORM\ManyToOne(targetEntity=ATPProgram::class, inversedBy="aTPProgramCourts")
* @ORM\JoinColumn(nullable=false)
* @Groups( "atpprogram:list", "atpprogram:item")
* @Ignore()
*/
private $program;
/**
* @ORM\ManyToOne(targetEntity=Court::class, inversedBy="aTPProgramCourts")
* @ORM\JoinColumn(nullable=false)
* @Groups( {"atpprogram:list", "atpprogram:item"})
*
*/
private $court;
/**
* @ORM\OneToMany(targetEntity=Game::class, mappedBy="court")
* @Groups( {"atpprogram:list", "atpprogram:item"})
*/
private $games;
public function __construct()
{
$this->games = new ArrayCollection();
}
public function __toString()
{
return $this->getCourt()->getName();
}
public function getId(): ?int
{
return $this->id;
}
public function getDisplayTime(): ?\DateTimeInterface
{
return $this->displayTime;
}
public function setDisplayTime(?\DateTimeInterface $displayTime): self
{
$this->displayTime = $displayTime;
return $this;
}
public function getProgram(): ?ATPProgram
{
return $this->program;
}
public function setProgram(?ATPProgram $program): self
{
$this->program = $program;
return $this;
}
public function getCourt(): ?Court
{
return $this->court;
}
public function setCourt(?Court $court): self
{
$this->court = $court;
return $this;
}
/**
* @return Collection|Game[]
*/
public function getGames(): Collection
{
return $this->games;
}
public function addGame(Game $game): self
{
if (!$this->games->contains($game)) {
$this->games[] = $game;
$game->setCourt($this);
}
return $this;
}
public function removeGame(Game $game): self
{
if ($this->games->removeElement($game)) {
// set the owning side to null (unless already changed)
if ($game->getCourt() === $this) {
$game->setCourt(null);
}
}
return $this;
}
}