welcome back to dyb-tech
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace DMD\LaLigaApi\Entity;
|
||||
|
||||
use DMD\LaLigaApi\Repository\GameRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GameRepository::class)]
|
||||
class Game
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $pointsHome = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $pointsAway = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $plannedDate = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $gameDateTime = null;
|
||||
|
||||
#[ORM\Column(length: 350, nullable: true)]
|
||||
private ?string $notes = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'game', targetEntity: File::class)]
|
||||
private Collection $files;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'games')]
|
||||
private ?Season $season = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'games')]
|
||||
private ?Facility $facility = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?Team $homeTeam = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?Team $awayTeam = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->files = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPointsHome(): ?int
|
||||
{
|
||||
return $this->pointsHome;
|
||||
}
|
||||
|
||||
public function setPointsHome(?int $pointsHome): static
|
||||
{
|
||||
$this->pointsHome = $pointsHome;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPointsAway(): ?int
|
||||
{
|
||||
return $this->pointsAway;
|
||||
}
|
||||
|
||||
public function setPointsAway(?int $pointsAway): static
|
||||
{
|
||||
$this->pointsAway = $pointsAway;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlannedDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->plannedDate;
|
||||
}
|
||||
|
||||
public function setPlannedDate(?\DateTimeInterface $plannedDate): static
|
||||
{
|
||||
$this->plannedDate = $plannedDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGameDateTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->gameDateTime;
|
||||
}
|
||||
|
||||
public function setGameDateTime(?\DateTimeInterface $gameDateTime): static
|
||||
{
|
||||
$this->gameDateTime = $gameDateTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNotes(): ?string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function setNotes(?string $notes): static
|
||||
{
|
||||
$this->notes = $notes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, File>
|
||||
*/
|
||||
public function getFiles(): Collection
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
public function addFile(File $file): static
|
||||
{
|
||||
if (!$this->files->contains($file)) {
|
||||
$this->files->add($file);
|
||||
$file->setGame($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeFile(File $file): static
|
||||
{
|
||||
if ($this->files->removeElement($file)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($file->getGame() === $this) {
|
||||
$file->setGame(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSeason(): ?Season
|
||||
{
|
||||
return $this->season;
|
||||
}
|
||||
|
||||
public function setSeason(?Season $season): static
|
||||
{
|
||||
$this->season = $season;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFacility(): ?Facility
|
||||
{
|
||||
return $this->facility;
|
||||
}
|
||||
|
||||
public function setFacility(?Facility $facility): static
|
||||
{
|
||||
$this->facility = $facility;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHomeTeam(): ?Team
|
||||
{
|
||||
return $this->homeTeam;
|
||||
}
|
||||
|
||||
public function setHomeTeam(?Team $homeTeam): static
|
||||
{
|
||||
$this->homeTeam = $homeTeam;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAwayTeam(): ?Team
|
||||
{
|
||||
return $this->awayTeam;
|
||||
}
|
||||
|
||||
public function setAwayTeam(?Team $awayTeam): static
|
||||
{
|
||||
$this->awayTeam = $awayTeam;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function setCreatedAt(): static
|
||||
{
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user