src/Entity/ATPProgramCourt.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ATPProgramCourtRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Serializer\Annotation\Ignore;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ATPProgramCourtRepository::class)
  11.  */
  12. class ATPProgramCourt
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      * @Groups( "atpprogram:list", "atpprogram:item")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="time", nullable=true)
  23.      * @Groups( "atpprogram:list", "atpprogram:item")
  24.      */
  25.     private $displayTime;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=ATPProgram::class, inversedBy="aTPProgramCourts")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      * @Groups( "atpprogram:list", "atpprogram:item")
  30.      * @Ignore()
  31.      */
  32.     private $program;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity=Court::class, inversedBy="aTPProgramCourts")
  35.      * @ORM\JoinColumn(nullable=false)
  36.      * @Groups( {"atpprogram:list", "atpprogram:item"})
  37.      *
  38.      */
  39.     private $court;
  40.     /**
  41.      *  @ORM\OneToMany(targetEntity=Game::class, mappedBy="court")
  42.      *  @Groups( {"atpprogram:list", "atpprogram:item"})
  43.      */
  44.     private $games;
  45.     public function __construct()
  46.     {
  47.         $this->games = new ArrayCollection();
  48.     }
  49.     public function __toString()
  50.     {
  51.         return $this->getCourt()->getName();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getDisplayTime(): ?\DateTimeInterface
  58.     {
  59.         return $this->displayTime;
  60.     }
  61.     public function setDisplayTime(?\DateTimeInterface $displayTime): self
  62.     {
  63.         $this->displayTime $displayTime;
  64.         return $this;
  65.     }
  66.     public function getProgram(): ?ATPProgram
  67.     {
  68.         return $this->program;
  69.     }
  70.     public function setProgram(?ATPProgram $program): self
  71.     {
  72.         $this->program $program;
  73.         return $this;
  74.     }
  75.     public function getCourt(): ?Court
  76.     {
  77.         return $this->court;
  78.     }
  79.     public function setCourt(?Court $court): self
  80.     {
  81.         $this->court $court;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection|Game[]
  86.      */
  87.     public function getGames(): Collection
  88.     {
  89.         return $this->games;
  90.     }
  91.     public function addGame(Game $game): self
  92.     {
  93.         if (!$this->games->contains($game)) {
  94.             $this->games[] = $game;
  95.             $game->setCourt($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeGame(Game $game): self
  100.     {
  101.         if ($this->games->removeElement($game)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($game->getCourt() === $this) {
  104.                 $game->setCourt(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109. }