<?php
namespace App\Entity;
use App\Repository\GlobalQuarterRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\Timestampable;
use JMS\Serializer\Annotation\Groups;
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: GlobalQuarterRepository::class)]
class GlobalQuarter
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\ManyToOne(inversedBy: 'globalQuarters')]
#[ORM\JoinColumn(nullable: false)]
private ?School $school = null;
#[ORM\ManyToOne(inversedBy: 'globalQuarters')]
#[ORM\JoinColumn(nullable: false)]
private ?SchoolYear $year = null;
#[ORM\OneToMany(mappedBy: 'globalQuarter', targetEntity: Quarter::class, orphanRemoval: true)]
private Collection $quarter;
public function __construct()
{
$this->quarter = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
public function getYear(): ?SchoolYear
{
return $this->year;
}
public function setYear(?SchoolYear $year): static
{
$this->year = $year;
return $this;
}
/**
* @return Collection<int, Quarter>
*/
public function getQuarter(): Collection
{
return $this->quarter;
}
public function addQuarter(Quarter $quarter): static
{
if (!$this->quarter->contains($quarter)) {
$this->quarter->add($quarter);
$quarter->setGlobalQuarter($this);
}
return $this;
}
public function removeQuarter(Quarter $quarter): static
{
if ($this->quarter->removeElement($quarter)) {
// set the owning side to null (unless already changed)
if ($quarter->getGlobalQuarter() === $this) {
$quarter->setGlobalQuarter(null);
}
}
return $this;
}
}