src/Entity/MatchTeam.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TeamRepository;
  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\Ignore;
  8. /**
  9.  * @ORM\Entity(repositoryClass=TeamRepository::class)
  10.  */
  11. class MatchTeam
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $teamNumber;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $teamCode;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Player::class, inversedBy="matchTeams")
  29.      * @ORM\JoinColumn(nullable=true)
  30.      * @Ignore
  31.      */
  32.     private $players;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity=TeamPlayer::class, mappedBy="matchTeam")
  35.      *
  36.      */
  37.     private $teamPlayer;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity=Game::class, mappedBy="matchTeams")
  40.      * @Ignore()
  41.      */
  42.     private $games;
  43.     public function __construct()
  44.     {
  45.         $this->teamPlayer = new ArrayCollection();
  46.         $this->games = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getTeamNumber(): ?int
  53.     {
  54.         return $this->teamNumber;
  55.     }
  56.     public function setTeamNumber(int $teamNumber): self
  57.     {
  58.         $this->teamNumber $teamNumber;
  59.         return $this;
  60.     }
  61.     public function getTeamCode(): ?string
  62.     {
  63.         return $this->teamCode;
  64.     }
  65.     public function setTeamCode(?string $teamCode): self
  66.     {
  67.         $this->teamCode $teamCode;
  68.         return $this;
  69.     }
  70.     public function getPlayers(): ?Player
  71.     {
  72.         return $this->players;
  73.     }
  74.     public function setPlayers(?Player $players): self
  75.     {
  76.         $this->players $players;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection|TeamPlayer[]
  81.      */
  82.     public function getTeamPlayer(): Collection
  83.     {
  84.         return $this->teamPlayer;
  85.     }
  86.     public function addTeamPlayer(TeamPlayer $teamPlayer): self
  87.     {
  88.         if (!$this->teamPlayer->contains($teamPlayer)) {
  89.             $this->teamPlayer[] = $teamPlayer;
  90.             $teamPlayer->setMatchTeam($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeTeamPlayer(TeamPlayer $teamPlayer): self
  95.     {
  96.         if ($this->teamPlayer->removeElement($teamPlayer)) {
  97.             // set the owning side to null (unless already changed)
  98.             if ($teamPlayer->getMatchTeam() === $this) {
  99.                 $teamPlayer->setMatchTeam(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, Game>
  106.      */
  107.     public function getGames(): Collection
  108.     {
  109.         return $this->games;
  110.     }
  111.     public function addGame(Game $game): self
  112.     {
  113.         if (!$this->games->contains($game)) {
  114.             $this->games[] = $game;
  115.             $game->addMatchTeam($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeGame(Game $game): self
  120.     {
  121.         if ($this->games->removeElement($game)) {
  122.             $game->removeMatchTeam($this);
  123.         }
  124.         return $this;
  125.     }
  126. }