src/Entity/Promotion.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PromotionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PromotionRepository::class)
  9.  */
  10. class Promotion
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=School::class, inversedBy="promotions")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private $school;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Classe::class, inversedBy="promotions")
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $class;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity=SchoolYear::class, inversedBy="promotions")
  30.      * @ORM\JoinColumn(nullable=false)
  31.      */
  32.     private $schoolYear;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $label;
  37.     /**
  38.      * @ORM\Column(type="datetime_immutable")
  39.      */
  40.     private $createdAt;
  41.     /**
  42.      * @ORM\Column(type="datetime_immutable", nullable=true)
  43.      */
  44.     private $updatedAt;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=Student::class, mappedBy="promotion")
  47.      */
  48.     private $students;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=Attendance::class, mappedBy="promotion")
  51.      */
  52.     private $attendances;
  53.     /**
  54.      * @ORM\ManyToMany(targetEntity=Teacher::class, inversedBy="promotions")
  55.      */
  56.     private $teachers;
  57.     /**
  58.      * @ORM\ManyToMany(targetEntity=Fee::class, mappedBy="promotions")
  59.      */
  60.     private $fees;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="promotion")
  63.      */
  64.     private $payments;
  65.     public function __construct()
  66.     {
  67.         $this->students = new ArrayCollection();
  68.         $this->teachers = new ArrayCollection();
  69.         $this->fees = new ArrayCollection();
  70.         $this->payments = new ArrayCollection();
  71.     }
  72.     public function __toString(): string
  73.     {
  74.         return $this->label;
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getSchool(): ?School
  81.     {
  82.         return $this->school;
  83.     }
  84.     public function setSchool(?School $school): self
  85.     {
  86.         $this->school $school;
  87.         return $this;
  88.     }
  89.     public function getClass(): ?Classe
  90.     {
  91.         return $this->class;
  92.     }
  93.     public function setClass(?Classe $class): self
  94.     {
  95.         $this->class $class;
  96.         return $this;
  97.     }
  98.     public function getSchoolYear(): ?SchoolYear
  99.     {
  100.         return $this->schoolYear;
  101.     }
  102.     public function setSchoolYear(?SchoolYear $schoolYear): self
  103.     {
  104.         $this->schoolYear $schoolYear;
  105.         return $this;
  106.     }
  107.     public function getLabel(): ?string
  108.     {
  109.         return $this->label;
  110.     }
  111.     public function setLabel(string $label): self
  112.     {
  113.         $this->label $label;
  114.         return $this;
  115.     }
  116.     public function getCreatedAt(): ?\DateTimeImmutable
  117.     {
  118.         return $this->createdAt;
  119.     }
  120.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  121.     {
  122.         $this->createdAt $createdAt;
  123.         return $this;
  124.     }
  125.     public function getUpdatedAt(): ?\DateTimeImmutable
  126.     {
  127.         return $this->updatedAt;
  128.     }
  129.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  130.     {
  131.         $this->updatedAt $updatedAt;
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return Collection<int, Student>
  136.      */
  137.     public function getStudents(): Collection
  138.     {
  139.         return $this->students;
  140.     }
  141.     public function addStudent(Student $student): self
  142.     {
  143.         if (!$this->students->contains($student)) {
  144.             $this->students->add($student);
  145.             $student->setPromotion($this);
  146.         }
  147.         return $this;
  148.     }
  149.     public function removeStudent(Student $student): self
  150.     {
  151.         if ($this->students->removeElement($student)) {
  152.             // set the owning side to null (unless already changed)
  153.             if ($student->getPromotion() === $this) {
  154.                 $student->setPromotion(null);
  155.             }
  156.         }
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return Collection<int, Attendance>
  161.      */
  162.     public function getAttendances(): Collection
  163.     {
  164.         return $this->attendances;
  165.     }
  166.     public function addAttendance(Attendance $attendance): self
  167.     {
  168.         if (!$this->attendances->contains($attendance)) {
  169.             $this->attendances->add($attendance);
  170.             $attendance->setPromotion($this);
  171.         }
  172.         return $this;
  173.     }
  174.     public function removeAttendance(Attendance $attendance): self
  175.     {
  176.         if ($this->attendances->removeElement($attendance)) {
  177.             // set the owning side to null (unless already changed)
  178.             if ($attendance->getPromotion() === $this) {
  179.                 $attendance->setPromotion(null);
  180.             }
  181.         }
  182.         return $this;
  183.     }
  184.     /**
  185.      * @return Collection<int, Teacher>
  186.      */
  187.     public function getTeachers(): Collection
  188.     {
  189.         return $this->teachers;
  190.     }
  191.     public function addTeacher(Teacher $teacher): self
  192.     {
  193.         if (!$this->teachers->contains($teacher)) {
  194.             $this->teachers->add($teacher);
  195.             $teacher->addPromotion($this);
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeTeacher(Teacher $teacher): self
  200.     {
  201.         if ($this->teachers->removeElement($teacher)) {
  202.             $teacher->removePromotion($this);
  203.         }
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection<int, Fee>
  208.      */
  209.     public function getFees(): Collection
  210.     {
  211.         return $this->fees;
  212.     }
  213.     public function addFee(Fee $fee): self
  214.     {
  215.         if (!$this->fees->contains($fee)) {
  216.             $this->fees->add($fee);
  217.             $fee->addPromotion($this);
  218.         }
  219.         return $this;
  220.     }
  221.     public function removeFee(Fee $fee): self
  222.     {
  223.         if ($this->fees->removeElement($fee)) {
  224.             $fee->removePromotion($this);
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection<int, Payment>
  230.      */
  231.     public function getPayments(): Collection
  232.     {
  233.         return $this->payments;
  234.     }
  235.     public function addPayment(Payment $payment): self
  236.     {
  237.         if (!$this->payments->contains($payment)) {
  238.             $this->payments->add($payment);
  239.             $payment->setPromotion($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removePayment(Payment $payment): self
  244.     {
  245.         if ($this->payments->removeElement($payment)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($payment->getPromotion() === $this) {
  248.                 $payment->setPromotion(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }