<?phpnamespace App\Entity;use App\Repository\TeamRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Ignore;/** * @ORM\Entity(repositoryClass=TeamRepository::class) */class MatchTeam{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="integer") */ private $teamNumber; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $teamCode; /** * @ORM\ManyToOne(targetEntity=Player::class, inversedBy="matchTeams") * @ORM\JoinColumn(nullable=true) * @Ignore */ private $players; /** * @ORM\OneToMany(targetEntity=TeamPlayer::class, mappedBy="matchTeam") * */ private $teamPlayer; /** * @ORM\ManyToMany(targetEntity=Game::class, mappedBy="matchTeams") * @Ignore() */ private $games; public function __construct() { $this->teamPlayer = new ArrayCollection(); $this->games = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTeamNumber(): ?int { return $this->teamNumber; } public function setTeamNumber(int $teamNumber): self { $this->teamNumber = $teamNumber; return $this; } public function getTeamCode(): ?string { return $this->teamCode; } public function setTeamCode(?string $teamCode): self { $this->teamCode = $teamCode; return $this; } public function getPlayers(): ?Player { return $this->players; } public function setPlayers(?Player $players): self { $this->players = $players; return $this; } /** * @return Collection|TeamPlayer[] */ public function getTeamPlayer(): Collection { return $this->teamPlayer; } public function addTeamPlayer(TeamPlayer $teamPlayer): self { if (!$this->teamPlayer->contains($teamPlayer)) { $this->teamPlayer[] = $teamPlayer; $teamPlayer->setMatchTeam($this); } return $this; } public function removeTeamPlayer(TeamPlayer $teamPlayer): self { if ($this->teamPlayer->removeElement($teamPlayer)) { // set the owning side to null (unless already changed) if ($teamPlayer->getMatchTeam() === $this) { $teamPlayer->setMatchTeam(null); } } return $this; } /** * @return Collection<int, Game> */ public function getGames(): Collection { return $this->games; } public function addGame(Game $game): self { if (!$this->games->contains($game)) { $this->games[] = $game; $game->addMatchTeam($this); } return $this; } public function removeGame(Game $game): self { if ($this->games->removeElement($game)) { $game->removeMatchTeam($this); } return $this; }}