<?php
namespace App\Entity;
use App\Repository\PlayerSportsInjuriesRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PlayerSportsInjuriesRepository::class)
*/
class PlayerSportsInjuries
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $note;
/**
* @ORM\Column(type="date")
*/
private $dateStart;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateEnd;
/**
* @ORM\Column(type="boolean")
*/
private $finish;
/**
* @ORM\ManyToOne(targetEntity=SeasonPlayer::class, inversedBy="playerSportsInjuries")
* @ORM\JoinColumn(nullable=false)
*/
private $seasonPlayer;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Season", inversedBy="games")
* @ORM\JoinColumn(nullable=false)
*/
private $season;
public function getSeason(): ?Season
{
return $this->season;
}
public function setSeason(?Season $season): self
{
$this->season = $season;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getDateStart(): ?\DateTimeInterface
{
return $this->dateStart;
}
public function setDateStart(\DateTimeInterface $dateStart): self
{
$this->dateStart = $dateStart;
return $this;
}
public function getDateEnd(): ?\DateTimeInterface
{
return $this->dateEnd;
}
public function setDateEnd(?\DateTimeInterface $dateEnd): self
{
$this->dateEnd = $dateEnd;
return $this;
}
public function getFinish(): ?bool
{
return $this->finish;
}
public function setFinish(bool $finish): self
{
$this->finish = $finish;
return $this;
}
public function getSeasonPlayer(): ?SeasonPlayer
{
return $this->seasonPlayer;
}
public function setSeasonPlayer(?SeasonPlayer $seasonPlayer): self
{
$this->seasonPlayer = $seasonPlayer;
return $this;
}
public function __toArray(){
return [
'id' => $this->id,
'created_at' => $this->createdAt->format('d-m-Y') ,
'finish' => $this->finish,
'note' => $this->note,
'season' => $this->season->getId(),
'seasonPlayer' => $this->seasonPlayer->getId(),
'dateStart' => $this->dateStart ? $this->dateStart->format('d-m-Y') : null,
'dateEnd' => $this->dateEnd ? $this->dateEnd->format('d-m-Y') : null,
];
}
}