<?php
namespace App\Entity;
use App\Repository\PromotionRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @ORM\Entity(repositoryClass=PromotionRepository::class)
*/
class Promotion
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=School::class, inversedBy="promotions")
* @ORM\JoinColumn(nullable=false)
*/
private $school;
/**
* @ORM\ManyToOne(targetEntity=Classe::class, inversedBy="promotions")
* @ORM\JoinColumn(nullable=false)
*/
private $class;
/**
* @ORM\ManyToOne(targetEntity=SchoolYear::class, inversedBy="promotions")
* @ORM\JoinColumn(nullable=false)
*/
private $schoolYear;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $updatedAt;
/**
* @ORM\OneToMany(targetEntity=Student::class, mappedBy="promotion")
*/
private $students;
/**
* @ORM\OneToMany(targetEntity=Attendance::class, mappedBy="promotion")
*/
private $attendances;
/**
* @ORM\ManyToMany(targetEntity=Teacher::class, inversedBy="promotions")
*/
private $teachers;
/**
* @ORM\ManyToMany(targetEntity=Fee::class, mappedBy="promotions")
*/
private $fees;
/**
* @ORM\OneToMany(targetEntity=Payment::class, mappedBy="promotion")
*/
private $payments;
public function __construct()
{
$this->students = new ArrayCollection();
$this->teachers = new ArrayCollection();
$this->fees = new ArrayCollection();
$this->payments = new ArrayCollection();
}
public function __toString(): string
{
return $this->label;
}
public function getId(): ?int
{
return $this->id;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): self
{
$this->school = $school;
return $this;
}
public function getClass(): ?Classe
{
return $this->class;
}
public function setClass(?Classe $class): self
{
$this->class = $class;
return $this;
}
public function getSchoolYear(): ?SchoolYear
{
return $this->schoolYear;
}
public function setSchoolYear(?SchoolYear $schoolYear): self
{
$this->schoolYear = $schoolYear;
return $this;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection<int, Student>
*/
public function getStudents(): Collection
{
return $this->students;
}
public function addStudent(Student $student): self
{
if (!$this->students->contains($student)) {
$this->students->add($student);
$student->setPromotion($this);
}
return $this;
}
public function removeStudent(Student $student): self
{
if ($this->students->removeElement($student)) {
// set the owning side to null (unless already changed)
if ($student->getPromotion() === $this) {
$student->setPromotion(null);
}
}
return $this;
}
/**
* @return Collection<int, Attendance>
*/
public function getAttendances(): Collection
{
return $this->attendances;
}
public function addAttendance(Attendance $attendance): self
{
if (!$this->attendances->contains($attendance)) {
$this->attendances->add($attendance);
$attendance->setPromotion($this);
}
return $this;
}
public function removeAttendance(Attendance $attendance): self
{
if ($this->attendances->removeElement($attendance)) {
// set the owning side to null (unless already changed)
if ($attendance->getPromotion() === $this) {
$attendance->setPromotion(null);
}
}
return $this;
}
/**
* @return Collection<int, Teacher>
*/
public function getTeachers(): Collection
{
return $this->teachers;
}
public function addTeacher(Teacher $teacher): self
{
if (!$this->teachers->contains($teacher)) {
$this->teachers->add($teacher);
$teacher->addPromotion($this);
}
return $this;
}
public function removeTeacher(Teacher $teacher): self
{
if ($this->teachers->removeElement($teacher)) {
$teacher->removePromotion($this);
}
return $this;
}
/**
* @return Collection<int, Fee>
*/
public function getFees(): Collection
{
return $this->fees;
}
public function addFee(Fee $fee): self
{
if (!$this->fees->contains($fee)) {
$this->fees->add($fee);
$fee->addPromotion($this);
}
return $this;
}
public function removeFee(Fee $fee): self
{
if ($this->fees->removeElement($fee)) {
$fee->removePromotion($this);
}
return $this;
}
/**
* @return Collection<int, Payment>
*/
public function getPayments(): Collection
{
return $this->payments;
}
public function addPayment(Payment $payment): self
{
if (!$this->payments->contains($payment)) {
$this->payments->add($payment);
$payment->setPromotion($this);
}
return $this;
}
public function removePayment(Payment $payment): self
{
if ($this->payments->removeElement($payment)) {
// set the owning side to null (unless already changed)
if ($payment->getPromotion() === $this) {
$payment->setPromotion(null);
}
}
return $this;
}
}