<?phpnamespace App\Entity;use App\Repository\GlobalSeasonRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: GlobalSeasonRepository::class)]class GlobalSeason{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'date_immutable')] private $startAt; #[ORM\Column(type: 'date_immutable')] private $endAt; #[ORM\Column(type: 'boolean')] private $isActive; #[ORM\OneToMany(mappedBy: 'globalSeason', targetEntity: Season::class)] private $seasons; public function __construct() { $this->seasons = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getStartAt(): ?\DateTimeImmutable { return $this->startAt; } public function setStartAt(\DateTimeImmutable $startAt): self { $this->startAt = $startAt; return $this; } public function getEndAt(): ?\DateTimeImmutable { return $this->endAt; } public function setEndAt(\DateTimeImmutable $endAt): self { $this->endAt = $endAt; return $this; } public function getIsActive(): ?bool { return $this->isActive; } public function setIsActive(bool $isActive): self { $this->isActive = $isActive; return $this; } /** * @return Collection<int, Season> */ public function getSeasons(): Collection { return $this->seasons; } public function addSeason(Season $season): self { if (!$this->seasons->contains($season)) { $this->seasons[] = $season; $season->setGlobalSeason($this); } return $this; } public function removeSeason(Season $season): self { if ($this->seasons->removeElement($season)) { // set the owning side to null (unless already changed) if ($season->getGlobalSeason() === $this) { $season->setGlobalSeason(null); } } return $this; } public function __toString(): string { return sprintf('%s-%s', $this->getStartAt()?->format('Y'), $this->getEndAt()?->format('Y')); }}