src/Entity/Court.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CourtRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. use Gedmo\Translatable\Translatable;
  10. use Symfony\Component\Serializer\Annotation\Ignore;
  11. /**
  12.  * @ORM\Entity(repositoryClass=CourtRepository::class)
  13.  */
  14. class Court
  15. {
  16.     use TimestampableEntity;
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      * @Groups("program:list", "program:item", "atpprogram:list", "atpprogram:item")
  22.      * @Groups({"atpmatch_result:list", "atpmatch_result:item", "atpmatch_result:list", "atpmatch_result:item","atpprogram:list", "atpprogram:item"})
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      * @Groups("program:list", "program:item", "atpprogram:list", "atpprogram:item")
  28.      * @Groups({"atpmatch_result:list", "atpmatch_result:item", "atpmatch_result:list", "atpmatch_result:item","atpprogram:list", "atpprogram:item"})
  29.      */
  30.     private $name;
  31.     /**
  32.      * @ORM\ManyToMany(targetEntity=Program::class, mappedBy="tennisCourts")
  33.      * @Ignore()
  34.      */
  35.     private $programs;
  36.     /**
  37.      * @ORM\OneToMany(targetEntity=Game::class, mappedBy="court", orphanRemoval=true)
  38.      * @Groups("program:list", "program:item")
  39.      */
  40.     private $games;
  41.     /**
  42.      * @ORM\Column(type="integer", nullable=true)
  43.      * @Groups({"program:list", "program:item", "atpprogram:list", "atpprogram:item","atpprogram:list", "atpprogram:item"})
  44.      * @Groups("atpmatch_result:list", "atpmatch_result:item")
  45.      */
  46.     private $apiId;
  47.     /**
  48.      * @ORM\Column(type="integer")
  49.      * @Groups({"program:list", "program:item", "atpprogram:list", "atpprogram:item","atpprogram:list", "atpprogram:item"})
  50.      */
  51.     private $courtId;
  52.     /**
  53.      * @ORM\Column(type="string", length=255, nullable=true)
  54.      * @Groups({"program:list", "program:item", "atpprogram:list", "atpprogram:item","atpprogram:list", "atpprogram:item"})
  55.      */
  56.     private $courtOffset;
  57.     /**
  58.      * @ORM\Column(type="time", nullable=true)
  59.      * @Groups({"program:list", "program:item", "atpprogram:list", "atpprogram:item","atpprogram:list", "atpprogram:item"})
  60.      */
  61.     private $displayTime;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=ATPProgramCourt::class, mappedBy="court")
  64.      * @Ignore()
  65.      */
  66.     private $aTPProgramCourts;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=ATPMatchResult::class, mappedBy="court")
  69.      *  @Ignore()
  70.      */
  71.     private $aTPMatchResults;
  72.     public function __construct()
  73.     {
  74.         $this->programs = new ArrayCollection();
  75.         $this->games = new ArrayCollection();
  76.         $this->aTPProgramCourts = new ArrayCollection();
  77.         $this->aTPMatchResults = new ArrayCollection();
  78.     }
  79.     public function __toString()
  80.     {
  81.         return $this->name;
  82.     }
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getName(): ?string
  88.     {
  89.         return $this->name;
  90.     }
  91.     public function setName(string $name): self
  92.     {
  93.         $this->name $name;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection|Program[]
  98.      */
  99.     public function getPrograms(): Collection
  100.     {
  101.         return $this->programs;
  102.     }
  103.     public function addProgram(Program $program): self
  104.     {
  105.         if (!$this->programs->contains($program)) {
  106.             $this->programs[] = $program;
  107.             $program->addTennisCourt($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeProgram(Program $program): self
  112.     {
  113.         if ($this->programs->removeElement($program)) {
  114.             $program->removeTennisCourt($this);
  115.         }
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection|Game[]
  120.      */
  121.     public function getGames(): Collection
  122.     {
  123.         return $this->games;
  124.     }
  125.     public function addGame(Game $game): self
  126.     {
  127.         if (!$this->games->contains($game)) {
  128.             $this->games[] = $game;
  129.             $game->setCourt($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeGame(Game $game): self
  134.     {
  135.         if ($this->games->removeElement($game)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($game->getCourt() === $this) {
  138.                 $game->setCourt(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     public function getApiId(): ?int
  144.     {
  145.         return $this->apiId;
  146.     }
  147.     public function setApiId(?int $apiId): self
  148.     {
  149.         $this->apiId $apiId;
  150.         return $this;
  151.     }
  152.     public function getCourtId(): ?int
  153.     {
  154.         return $this->courtId;
  155.     }
  156.     public function setCourtId(int $courtId): self
  157.     {
  158.         $this->courtId $courtId;
  159.         return $this;
  160.     }
  161.     public function getCourtOffset(): ?string
  162.     {
  163.         return $this->courtOffset;
  164.     }
  165.     public function setCourtOffset(?string $courtOffset): self
  166.     {
  167.         $this->courtOffset $courtOffset;
  168.         return $this;
  169.     }
  170.     public function getDisplayTime(): ?\DateTimeInterface
  171.     {
  172.         return $this->displayTime;
  173.     }
  174.     public function setDisplayTime(?\DateTimeInterface $displayTime): self
  175.     {
  176.         $this->displayTime $displayTime;
  177.         return $this;
  178.     }
  179.     /**
  180.      * @return Collection<int, ATPProgramCourt>
  181.      */
  182.     public function getATPProgramCourts(): Collection
  183.     {
  184.         return $this->aTPProgramCourts;
  185.     }
  186.     public function addATPProgramCourt(ATPProgramCourt $aTPProgramCourt): self
  187.     {
  188.         if (!$this->aTPProgramCourts->contains($aTPProgramCourt)) {
  189.             $this->aTPProgramCourts[] = $aTPProgramCourt;
  190.             $aTPProgramCourt->setCourt($this);
  191.         }
  192.         return $this;
  193.     }
  194.     public function removeATPProgramCourt(ATPProgramCourt $aTPProgramCourt): self
  195.     {
  196.         if ($this->aTPProgramCourts->removeElement($aTPProgramCourt)) {
  197.             // set the owning side to null (unless already changed)
  198.             if ($aTPProgramCourt->getCourt() === $this) {
  199.                 $aTPProgramCourt->setCourt(null);
  200.             }
  201.         }
  202.         return $this;
  203.     }
  204.     /**
  205.      * @return Collection|ATPMatchResult[]
  206.      */
  207.     public function getATPMatchResults(): Collection
  208.     {
  209.         return $this->aTPMatchResults;
  210.     }
  211.     public function addATPMatchResult(ATPMatchResult $aTPMatchResult): self
  212.     {
  213.         if (!$this->aTPMatchResults->contains($aTPMatchResult)) {
  214.             $this->aTPMatchResults[] = $aTPMatchResult;
  215.             $aTPMatchResult->setCourt($this);
  216.         }
  217.         return $this;
  218.     }
  219.     public function removeATPMatchResult(ATPMatchResult $aTPMatchResult): self
  220.     {
  221.         if ($this->aTPMatchResults->removeElement($aTPMatchResult)) {
  222.             // set the owning side to null (unless already changed)
  223.             if ($aTPMatchResult->getCourt() === $this) {
  224.                 $aTPMatchResult->setCourt(null);
  225.             }
  226.         }
  227.         return $this;
  228.     }
  229. }