<?php
namespace App\Entity;
use App\Repository\TeamPlayerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=TeamPlayerRepository::class)
*/
class TeamPlayer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"atpmatch_result:list", "atpmatch_result:item"})
*/
private $id;
/**
* @ORM\Column(type="integer")
* @Groups({"atpmatch_result:list", "atpmatch_result:item"})
*/
private $orderInTeam;
/**
* @ORM\ManyToOne(targetEntity=MatchTeam::class, inversedBy="teamPlayer", cascade={"persist", "remove"})
* @Ignore
*/
private $matchTeam;
/**
* @ORM\ManyToOne(targetEntity=Player::class, inversedBy="teamPlayers")
* @Groups({"atpmatch_result:list", "atpmatch_result:item"})
*/
private $player;
/**
* @ORM\ManyToOne(targetEntity=Player::class, inversedBy="teamPlayerPartner")
* @Groups({"atpmatch_result:list", "atpmatch_result:item"})
*/
private $partner;
/**
* @ORM\OneToMany(targetEntity=ATPMatchResult::class, mappedBy="playerTeam1")
* @Ignore()
*/
private $aTPMatchResults;
/**
* @ORM\OneToMany(targetEntity=ATPMatchResult::class, mappedBy="playerTeam2")
* @Ignore()
*/
private $atPMatchResults2;
/**
* @ORM\OneToMany(targetEntity=Set::class, mappedBy="teamPlayer",cascade={"persist"})
* @Groups({"atpmatch_result:list", "atpmatch_result:item","round:list"})
*/
private $sets;
public function __construct()
{
$this->aTPMatchResults = new ArrayCollection();
$this->atPMatchResults2 = new ArrayCollection();
$this->sets = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getOrderInTeam(): ?int
{
return $this->orderInTeam;
}
public function setOrderInTeam(int $orderInTeam): self
{
$this->orderInTeam = $orderInTeam;
return $this;
}
public function getMatchTeam(): ?MatchTeam
{
return $this->matchTeam;
}
public function setMatchTeam(?MatchTeam $matchTeam): self
{
$this->matchTeam = $matchTeam;
return $this;
}
public function getPlayer(): ?Player
{
return $this->player;
}
public function setPlayer(?Player $player): self
{
$this->player = $player;
return $this;
}
/**
* @return Collection|ATPMatchResult[]
*/
public function getATPMatchResults(): Collection
{
return $this->aTPMatchResults;
}
public function addATPMatchResult(ATPMatchResult $aTPMatchResult): self
{
if (!$this->aTPMatchResults->contains($aTPMatchResult)) {
$this->aTPMatchResults[] = $aTPMatchResult;
$aTPMatchResult->setPlayerTeam1($this);
}
return $this;
}
public function removeATPMatchResult(ATPMatchResult $aTPMatchResult): self
{
if ($this->aTPMatchResults->removeElement($aTPMatchResult)) {
// set the owning side to null (unless already changed)
if ($aTPMatchResult->getPlayerTeam1() === $this) {
$aTPMatchResult->setPlayerTeam1(null);
}
}
return $this;
}
/**
* @return Collection|ATPMatchResult[]
*/
public function getAtPMatchResults2(): Collection
{
return $this->atPMatchResults2;
}
public function addAtPMatchResults2(ATPMatchResult $atPMatchResults2): self
{
if (!$this->atPMatchResults2->contains($atPMatchResults2)) {
$this->atPMatchResults2[] = $atPMatchResults2;
$atPMatchResults2->setPlayerTeam2($this);
}
return $this;
}
public function removeAtPMatchResults2(ATPMatchResult $atPMatchResults2): self
{
if ($this->atPMatchResults2->removeElement($atPMatchResults2)) {
// set the owning side to null (unless already changed)
if ($atPMatchResults2->getPlayerTeam2() === $this) {
$atPMatchResults2->setPlayerTeam2(null);
}
}
return $this;
}
/**
* @return Collection|Set[]
*/
public function getSets(): Collection
{
return $this->sets;
}
public function addSet(Set $set): self
{
if (!$this->sets->contains($set)) {
$this->sets[] = $set;
$set->setTeamPlayer($this);
}
return $this;
}
public function removeSet(Set $set): self
{
if ($this->sets->removeElement($set)) {
// set the owning side to null (unless already changed)
if ($set->getTeamPlayer() === $this) {
$set->setTeamPlayer(null);
}
}
return $this;
}
public function removeSets(): self
{
foreach ($this->getSets() as $set){
if ($this->sets->removeElement($set)) {
// set the owning side to null (unless already changed)
if ($set->getTeamPlayer() === $this) {
$set->setTeamPlayer(null);
}
}
}
return $this;
}
public function getPartner(): ?Player
{
return $this->partner;
}
public function setPartner(?Player $partner): self
{
$this->partner = $partner;
return $this;
}
}