src/Entity/PlayerSportsInjuries.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PlayerSportsInjuriesRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=PlayerSportsInjuriesRepository::class)
  7.  */
  8. class PlayerSportsInjuries
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="datetime")
  18.      */
  19.     private $createdAt;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $note;
  24.     /**
  25.      * @ORM\Column(type="date")
  26.      */
  27.     private $dateStart;
  28.     /**
  29.      * @ORM\Column(type="date", nullable=true)
  30.      */
  31.     private $dateEnd;
  32.     /**
  33.      * @ORM\Column(type="boolean")
  34.      */
  35.     private $finish;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=SeasonPlayer::class, inversedBy="playerSportsInjuries")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private $seasonPlayer;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity="App\Entity\Season", inversedBy="games")
  43.      * @ORM\JoinColumn(nullable=false)
  44.      */
  45.     private $season;
  46.     public function getSeason(): ?Season
  47.     {
  48.         return $this->season;
  49.     }
  50.     public function setSeason(?Season $season): self
  51.     {
  52.         $this->season $season;
  53.         return $this;
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getCreatedAt(): ?\DateTimeInterface
  60.     {
  61.         return $this->createdAt;
  62.     }
  63.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  64.     {
  65.         $this->createdAt $createdAt;
  66.         return $this;
  67.     }
  68.     public function getNote(): ?string
  69.     {
  70.         return $this->note;
  71.     }
  72.     public function setNote(?string $note): self
  73.     {
  74.         $this->note $note;
  75.         return $this;
  76.     }
  77.     public function getDateStart(): ?\DateTimeInterface
  78.     {
  79.         return $this->dateStart;
  80.     }
  81.     public function setDateStart(\DateTimeInterface $dateStart): self
  82.     {
  83.         $this->dateStart $dateStart;
  84.         return $this;
  85.     }
  86.     public function getDateEnd(): ?\DateTimeInterface
  87.     {
  88.         return $this->dateEnd;
  89.     }
  90.     public function setDateEnd(?\DateTimeInterface $dateEnd): self
  91.     {
  92.         $this->dateEnd $dateEnd;
  93.         return $this;
  94.     }
  95.     public function getFinish(): ?bool
  96.     {
  97.         return $this->finish;
  98.     }
  99.     public function setFinish(bool $finish): self
  100.     {
  101.         $this->finish $finish;
  102.         return $this;
  103.     }
  104.     public function getSeasonPlayer(): ?SeasonPlayer
  105.     {
  106.         return $this->seasonPlayer;
  107.     }
  108.     public function setSeasonPlayer(?SeasonPlayer $seasonPlayer): self
  109.     {
  110.         $this->seasonPlayer $seasonPlayer;
  111.         return $this;
  112.     }
  113.     public function __toArray(){
  114.         return [
  115.             'id' => $this->id,
  116.             'created_at' => $this->createdAt->format('d-m-Y')    ,
  117.             'finish' => $this->finish,
  118.             'note' => $this->note,
  119.             'season' => $this->season->getId(),
  120.             'seasonPlayer' => $this->seasonPlayer->getId(),
  121.             'dateStart' => $this->dateStart $this->dateStart->format('d-m-Y') : null,
  122.             'dateEnd' => $this->dateEnd $this->dateEnd->format('d-m-Y') : null,
  123.         ];
  124.     }
  125. }