src/Entity/PlayerWeight.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PlayerWeightRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=PlayerWeightRepository::class)
  7.  */
  8. class PlayerWeight
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="decimal", precision=2, scale=2)
  18.      */
  19.     private $weight;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity=SeasonPlayer::class, inversedBy="playerWeights")
  22.      * @ORM\JoinColumn(nullable=false)
  23.      */
  24.     private $seasonPlayer;
  25.     /**
  26.      * @ORM\Column(type="date")
  27.      */
  28.     private $date;
  29.     /**
  30.      * @ORM\Column(type="time", nullable=true)
  31.      */
  32.     private $time;
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getWeight(): ?string
  38.     {
  39.         return $this->weight;
  40.     }
  41.     public function setWeight(string $weight): self
  42.     {
  43.         $this->weight $weight;
  44.         return $this;
  45.     }
  46.     public function getSeasonPlayer(): ?SeasonPlayer
  47.     {
  48.         return $this->seasonPlayer;
  49.     }
  50.     public function setSeasonPlayer(?SeasonPlayer $seasonPlayer): self
  51.     {
  52.         $this->seasonPlayer $seasonPlayer;
  53.         return $this;
  54.     }
  55.     public function getDate(): ?\DateTimeInterface
  56.     {
  57.         return $this->date;
  58.     }
  59.     public function setDate(?\DateTimeInterface $date): self
  60.     {
  61.         $this->date $date;
  62.         return $this;
  63.     }
  64.     public function getTime(): ?\DateTimeInterface
  65.     {
  66.         return $this->time;
  67.     }
  68.     public function setTime(?\DateTimeInterface $time): self
  69.     {
  70.         $this->time $time;
  71.         return $this;
  72.     }
  73.     public function __toArray(){
  74.         return [
  75.             'id' => $this->getId(),
  76.             'weight' => $this->getWeight(),
  77.             'date' => $this->getDate()->format('Y-m-d'),
  78.             'time' => $this->getTime()->format('H:i:s'),
  79.         ];
  80.     }
  81. }