src/Entity/GlobalQuarter.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GlobalQuarterRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\Traits\Timestampable;
  8. use JMS\Serializer\Annotation\Groups;
  9. #[ORM\HasLifecycleCallbacks]
  10. #[ORM\Entity(repositoryClassGlobalQuarterRepository::class)]
  11. class GlobalQuarter
  12. {
  13.     use Timestampable;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\ManyToOne(inversedBy'globalQuarters')]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     private ?School $school null;
  23.     #[ORM\ManyToOne(inversedBy'globalQuarters')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?SchoolYear $year null;
  26.     #[ORM\OneToMany(mappedBy'globalQuarter'targetEntityQuarter::class, orphanRemovaltrue)]
  27.     private Collection $quarter;
  28.     public function __construct()
  29.     {
  30.         $this->quarter = new ArrayCollection();
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): static
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function getSchool(): ?School
  46.     {
  47.         return $this->school;
  48.     }
  49.     public function setSchool(?School $school): static
  50.     {
  51.         $this->school $school;
  52.         return $this;
  53.     }
  54.     public function getYear(): ?SchoolYear
  55.     {
  56.         return $this->year;
  57.     }
  58.     public function setYear(?SchoolYear $year): static
  59.     {
  60.         $this->year $year;
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return Collection<int, Quarter>
  65.      */
  66.     public function getQuarter(): Collection
  67.     {
  68.         return $this->quarter;
  69.     }
  70.     public function addQuarter(Quarter $quarter): static
  71.     {
  72.         if (!$this->quarter->contains($quarter)) {
  73.             $this->quarter->add($quarter);
  74.             $quarter->setGlobalQuarter($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeQuarter(Quarter $quarter): static
  79.     {
  80.         if ($this->quarter->removeElement($quarter)) {
  81.             // set the owning side to null (unless already changed)
  82.             if ($quarter->getGlobalQuarter() === $this) {
  83.                 $quarter->setGlobalQuarter(null);
  84.             }
  85.         }
  86.         return $this;
  87.     }
  88. }