<?php
namespace App\Entity;
use App\Repository\PlayerWeightRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PlayerWeightRepository::class)
*/
class PlayerWeight
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="decimal", precision=2, scale=2)
*/
private $weight;
/**
* @ORM\ManyToOne(targetEntity=SeasonPlayer::class, inversedBy="playerWeights")
* @ORM\JoinColumn(nullable=false)
*/
private $seasonPlayer;
/**
* @ORM\Column(type="date")
*/
private $date;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $time;
public function getId(): ?int
{
return $this->id;
}
public function getWeight(): ?string
{
return $this->weight;
}
public function setWeight(string $weight): self
{
$this->weight = $weight;
return $this;
}
public function getSeasonPlayer(): ?SeasonPlayer
{
return $this->seasonPlayer;
}
public function setSeasonPlayer(?SeasonPlayer $seasonPlayer): self
{
$this->seasonPlayer = $seasonPlayer;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getTime(): ?\DateTimeInterface
{
return $this->time;
}
public function setTime(?\DateTimeInterface $time): self
{
$this->time = $time;
return $this;
}
public function __toArray(){
return [
'id' => $this->getId(),
'weight' => $this->getWeight(),
'date' => $this->getDate()->format('Y-m-d'),
'time' => $this->getTime()->format('H:i:s'),
];
}
}