src/Entity/TheClass.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TheClassRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation\Groups;
  8. use JMS\Serializer\Annotation\SerializedName;
  9. use JMS\Serializer\Annotation\VirtualProperty;
  10. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  11. use App\Entity\Traits\Timestampable;
  12. #[ORM\HasLifecycleCallbacks]
  13. #[ORM\Entity(repositoryClassTheClassRepository::class)]
  14. class TheClass
  15. {
  16.     use Timestampable;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     #[Groups(['homework','getLate','note','getStudents','getSubject','getClass','getDiscussionClass','getExamStudent','getStatsStudentParentIndex','getAbsence','getPunish','getAgenda'])]
  21.     private ?int $id null;
  22.     #[ORM\Column(length255)]
  23.     #[Groups(['homework','getLate','note','getStudents','getClass','getDiscussionClass','getDiscussion','getExamStudent','getAbsence','getPunish','getStatsStudentParentIndex','getAbsence','getAgenda'])]
  24.     private ?string $name null;
  25.     // Utilisée à la place du nom partout où la classe est simplement listée (menus, listes
  26.     // déroulantes, tableaux...) ; le nom complet reste seul utilisé pour la génération des
  27.     // documents (bulletins...). Optionnelle : si absente, on retombe sur le nom complet
  28.     // (voir getDisplayName()).
  29.     #[ORM\Column(length20nullabletrue)]
  30.     #[Groups(['homework','getLate','note','getStudents','getClass','getDiscussionClass','getDiscussion','getExamStudent','getAbsence','getPunish','getStatsStudentParentIndex','getAbsence','getAgenda'])]
  31.     private ?string $abreviation null;
  32.     #[ORM\ManyToOne(cascade: ["persist"], inversedBy'theClasses')]
  33.     #[ORM\JoinColumn(nullablefalse)]
  34.     private ?SchoolSection $section null;
  35.     #[ORM\OneToMany(mappedBy'classe'targetEntityStudentYear::class)]
  36.     private Collection $studentsYears;
  37.     #[ORM\OneToMany(mappedBy'classe'targetEntitySubject::class)]
  38.     private Collection $subjects;
  39.     #[ORM\OneToMany(mappedBy'classe'targetEntityHomeWork::class)]
  40.     private Collection $homeWorks;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?bool $active null;
  43.     #[ORM\OneToMany(mappedBy'classe'targetEntityNote::class)]
  44.     private Collection $notes;
  45.     #[ORM\ManyToMany(targetEntityUserYear::class, mappedBy'classes')]
  46.     private Collection $userYears;
  47.     #[ORM\ManyToMany(targetEntityDocInfo::class, mappedBy'classes'cascade: ['persist''remove'])]
  48.     private Collection $docInfos;
  49.     #[ORM\ManyToOne(cascade: ["persist"], inversedBy'theClasses')]
  50.     private ?User $author null;
  51.     #[ORM\ManyToOne(cascade: ["persist"], inversedBy'theClassesEdited')]
  52.     private ?User $editor null;
  53.     #[ORM\ManyToOne(cascade: ["persist"], inversedBy'theClasses')]
  54.     #[Groups(['getClass'])]
  55.     private ?School $school null;
  56.     #[ORM\OneToMany(mappedBy'classe'targetEntityDiscussionClass::class)]
  57.     private Collection $discussionClasses;
  58.     #[ORM\OneToMany(mappedBy'classe'targetEntitySubjectGroup::class, orphanRemovaltrue)]
  59.     private Collection $subjectGroups;
  60.     #[ORM\OneToMany(mappedBy'classe'targetEntityScolarity::class, orphanRemovaltrue)]
  61.     private Collection $scolarities;
  62.     #[ORM\OneToMany(mappedBy'classe'targetEntityExamAgenda::class)]
  63.     private Collection $examAgendas;
  64.     #[ORM\OneToMany(mappedBy'classe'targetEntitySubSequence::class, orphanRemovaltrue)]
  65.     private Collection $subSequences;
  66.     #[ORM\OneToMany(mappedBy'classe'targetEntityQuarter::class, orphanRemovaltrue)]
  67.     private Collection $quarters;
  68.     #[ORM\OneToMany(mappedBy'classe'targetEntitySubNote::class, orphanRemovaltrue)]
  69.     private Collection $subNotes;
  70.     #[ORM\OneToMany(mappedBy'classe'targetEntityPunish::class)]
  71.     private Collection $punishes;
  72.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplineWarning::class)]
  73.     private Collection $disciplineWarnings;
  74.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplineBlame::class)]
  75.     private Collection $disciplineBlames;
  76.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplineExclusion::class)]
  77.     private Collection $disciplineExclusions;
  78.     #[ORM\OneToMany(mappedBy'classe'targetEntityParentNote::class)]
  79.     private Collection $parentNotes;
  80.     #[ORM\OneToMany(mappedBy'classe'targetEntityAbsence::class)]
  81.     private Collection $absences;
  82.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplineRetained::class)]
  83.     private Collection $disciplineRetaineds;
  84.     #[ORM\ManyToOne(inversedBy'theClassesTeached')]
  85.     private ?User $prof null;
  86.     #[ORM\OneToMany(mappedBy'classe'targetEntityPrimaryParentNote::class)]
  87.     private Collection $primaryParentNotes;
  88.     #[ORM\OneToMany(mappedBy'classe'targetEntityPrimaryNote::class)]
  89.     private Collection $primaryNotes;
  90.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplinePunish::class)]
  91.     private Collection $disciplinePunishes;
  92.     #[ORM\OneToMany(mappedBy'classe'targetEntityLate::class)]
  93.     private Collection $lates;
  94.     #[ORM\OneToMany(mappedBy'classe'targetEntityBlame::class)]
  95.     private Collection $blames;
  96.     #[ORM\OneToMany(mappedBy'classe'targetEntityWarning::class)]
  97.     private Collection $warnings;
  98.     #[ORM\OneToMany(mappedBy'classe'targetEntityRetained::class)]
  99.     private Collection $retaineds;
  100.     #[ORM\Column(length255nullabletrue)]
  101.     private ?string $slug null;
  102.     #[ORM\OneToMany(mappedBy'classe'targetEntityDisciplineConcile::class)]
  103.     private Collection $disciplineConciles;
  104.     #[ORM\ManyToOne(inversedBy'principalClasses')]
  105.     private ?UserYear $principalProf null;
  106.     #[ORM\OneToMany(mappedBy'classe'targetEntityCompetence::class)]
  107.     private Collection $competences;
  108.     #[ORM\OneToMany(mappedBy'classe'targetEntityWeekSubjectGoal::class)]
  109.     private Collection $weekSubjectGoals;
  110.     #[ORM\OneToMany(mappedBy'classe'targetEntityAgendaElement::class)]
  111.     private Collection $agendaElements;
  112.     #[ORM\ManyToOne(inversedBy'classes')]
  113.     private ?ClassLevel $classLevel null;
  114.     #[ORM\ManyToMany(targetEntityClassOption::class, inversedBy'theClasses')]
  115.     #[ORM\JoinTable(name'the_class_class_option')]
  116.     private Collection $classOptions;
  117.     #[ORM\ManyToMany(targetEntityTheClass::class)]
  118.     #[ORM\JoinTable(
  119.         name'class_next_class',
  120.         joinColumns: [new ORM\JoinColumn(name'class_id'referencedColumnName'id')],
  121.         inverseJoinColumns: [new ORM\JoinColumn(name'next_class_id'referencedColumnName'id')]
  122.     )]
  123.     private Collection $nextClasses;
  124.     public function __toString(): string
  125.     {
  126.         return $this->name;
  127.     }
  128.     public function __construct()
  129.     {
  130.         $this->subjects = new ArrayCollection();
  131.         $this->studentsYears = new ArrayCollection();
  132.         $this->homeWorks = new ArrayCollection();
  133.         $this->notes = new ArrayCollection();
  134.         $this->userYears = new ArrayCollection();
  135.         $this->docInfos = new ArrayCollection();
  136.         $this->discussionClasses = new ArrayCollection();
  137.         $this->subjectGroups = new ArrayCollection();
  138.         $this->scolarities = new ArrayCollection();
  139.         $this->subSequences = new ArrayCollection();
  140.         $this->quarters = new ArrayCollection();
  141.         $this->subNotes = new ArrayCollection();
  142.         $this->disciplineWarnings = new ArrayCollection();
  143.         $this->disciplineBlames = new ArrayCollection();
  144.         $this->disciplineExclusions = new ArrayCollection();
  145.         $this->parentNotes = new ArrayCollection();
  146.         $this->absences = new ArrayCollection();
  147.         $this->disciplineRetaineds = new ArrayCollection();
  148.         $this->primaryParentNotes = new ArrayCollection();
  149.         $this->primaryNotes = new ArrayCollection();
  150.         $this->punishes = new ArrayCollection();
  151.         $this->disciplinePunishes = new ArrayCollection();
  152.         $this->lates = new ArrayCollection();
  153.         $this->blames = new ArrayCollection();
  154.         $this->warnings = new ArrayCollection();
  155.         $this->retaineds = new ArrayCollection();
  156.         $this->disciplineConciles = new ArrayCollection();
  157.         $this->competences = new ArrayCollection();
  158.         $this->weekSubjectGoals = new ArrayCollection();
  159.         $this->agendaElements = new ArrayCollection();
  160.         $this->classOptions   = new ArrayCollection();
  161.         $this->nextClasses    = new ArrayCollection();
  162.     }
  163.     public function getId(): ?int
  164.     {
  165.         return $this->id;
  166.     }
  167.     public function getName(): ?string
  168.     {
  169.         return $this->name;
  170.     }
  171.     public function setName(string $name): static
  172.     {
  173.         $this->name $name;
  174.         return $this;
  175.     }
  176.     public function getAbreviation(): ?string
  177.     {
  178.         return $this->abreviation;
  179.     }
  180.     public function setAbreviation(?string $abreviation): static
  181.     {
  182.         $this->abreviation $abreviation;
  183.         return $this;
  184.     }
  185.     // À utiliser partout où la classe est listée (web : `class.displayName` en Twig) ; la
  186.     // génération des documents doit continuer à utiliser getName() directement.
  187.     #[VirtualProperty]
  188.     #[SerializedName('displayName')]
  189.     #[Groups(['homework','getLate','note','getStudents','getClass','getDiscussionClass','getDiscussion','getExamStudent','getAbsence','getPunish','getStatsStudentParentIndex','getAbsence','getAgenda'])]
  190.     public function getDisplayName(): string
  191.     {
  192.         return $this->abreviation ?: $this->name;
  193.     }
  194.     public function getSection(): ?SchoolSection
  195.     {
  196.         return $this->section;
  197.     }
  198.     public function setSection(?SchoolSection $section): static
  199.     {
  200.         $this->section $section;
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, StudentYear>
  205.      */
  206.     public function getStudentsYears(): Collection
  207.     {
  208.         return $this->studentsYears;
  209.     }
  210.     public function addStudentsYear(StudentYear $studentsYear): static
  211.     {
  212.         if (!$this->studentsYears->contains($studentsYear)) {
  213.             $this->studentsYears->add($studentsYear);
  214.             $studentsYear->setClasse($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeStudentsYear(StudentYear $studentsYear): static
  219.     {
  220.         if ($this->studentsYears->removeElement($studentsYear)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($studentsYear->getClasse() === $this) {
  223.                 $studentsYear->setClasse(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection<int, Subject>
  230.      */
  231.     public function getSubjects(): Collection
  232.     {
  233.         return $this->subjects;
  234.     }
  235.     public function addSubject(Subject $subject): static
  236.     {
  237.         if (!$this->subjects->contains($subject)) {
  238.             $this->subjects->add($subject);
  239.             $subject->setClasse($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removeSubject(Subject $subject): static
  244.     {
  245.         if ($this->subjects->removeElement($subject)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($subject->getClasse() === $this) {
  248.                 $subject->setClasse(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection<int, HomeWork>
  255.      */
  256.     public function getHomeWorks(): Collection
  257.     {
  258.         return $this->homeWorks;
  259.     }
  260.     public function addHomeWork(HomeWork $homeWork): static
  261.     {
  262.         if (!$this->homeWorks->contains($homeWork)) {
  263.             $this->homeWorks->add($homeWork);
  264.             $homeWork->setClasse($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeHomework(HomeWork $homeWork): static
  269.     {
  270.         if ($this->homeWorks->removeElement($homeWork)) {
  271.             // set the owning side to null (unless already changed)
  272.             if ($homeWork->getClasse() === $this) {
  273.                 $homeWork->setClasse(null);
  274.             }
  275.         }
  276.         return $this;
  277.     }
  278.     public function isActive(): ?bool
  279.     {
  280.         return $this->active;
  281.     }
  282.     public function setActive(?bool $active): static
  283.     {
  284.         $this->active $active;
  285.         return $this;
  286.     }
  287.     /**
  288.      * @return Collection<int, Note>
  289.      */
  290.     public function getNotes(): Collection
  291.     {
  292.         return $this->notes;
  293.     }
  294.     public function addNote(Note $note): static
  295.     {
  296.         if (!$this->notes->contains($note)) {
  297.             $this->notes->add($note);
  298.             $note->setClasse($this);
  299.         }
  300.         return $this;
  301.     }
  302.     public function removeNote(Note $note): static
  303.     {
  304.         if ($this->notes->removeElement($note)) {
  305.             // set the owning side to null (unless already changed)
  306.             if ($note->getClasse() === $this) {
  307.                 $note->setClasse(null);
  308.             }
  309.         }
  310.         return $this;
  311.     }
  312.     /**
  313.      * @return Collection<int, UserYear>
  314.      */
  315.     public function getUserYears(): Collection
  316.     {
  317.         return $this->userYears;
  318.     }
  319.     public function addUserYear(UserYear $userYear): static
  320.     {
  321.         if (!$this->userYears->contains($userYear)) {
  322.             $this->userYears->add($userYear);
  323.             $userYear->addClass($this);
  324.         }
  325.         return $this;
  326.     }
  327.     public function removeUserYear(UserYear $userYear): static
  328.     {
  329.         if ($this->userYears->removeElement($userYear)) {
  330.             $userYear->removeClass($this);
  331.         }
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, DocInfo>
  336.      */
  337.     public function getDocInfos(): Collection
  338.     {
  339.         return $this->docInfos;
  340.     }
  341.     public function addDocInfo(DocInfo $docInfo): static
  342.     {
  343.         if (!$this->docInfos->contains($docInfo)) {
  344.             $this->docInfos->add($docInfo);
  345.             $docInfo->addClass($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeDocInfo(DocInfo $docInfo): static
  350.     {
  351.         if ($this->docInfos->removeElement($docInfo)) {
  352.             $docInfo->removeClass($this);
  353.         }
  354.         return $this;
  355.     }
  356.     public function getAuthor(): ?User
  357.     {
  358.         return $this->author;
  359.     }
  360.     public function setAuthor(?User $author): static
  361.     {
  362.         $this->author $author;
  363.         return $this;
  364.     }
  365.     public function getEditor(): ?User
  366.     {
  367.         return $this->editor;
  368.     }
  369.     public function setEditor(?User $editor): static
  370.     {
  371.         $this->editor $editor;
  372.         return $this;
  373.     }
  374.     public function getSchool(): ?School
  375.     {
  376.         return $this->school;
  377.     }
  378.     public function setSchool(?School $school): static
  379.     {
  380.         $this->school $school;
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return Collection<int, DiscussionClass>
  385.      */
  386.     public function getDiscussionClasses(): Collection
  387.     {
  388.         return $this->discussionClasses;
  389.     }
  390.     public function addDiscussionClass(DiscussionClass $discussionClass): static
  391.     {
  392.         if (!$this->discussionClasses->contains($discussionClass)) {
  393.             $this->discussionClasses->add($discussionClass);
  394.             $discussionClass->setClasse($this);
  395.         }
  396.         return $this;
  397.     }
  398.     public function removeDiscussionClass(DiscussionClass $discussionClass): static
  399.     {
  400.         if ($this->discussionClasses->removeElement($discussionClass)) {
  401.             // set the owning side to null (unless already changed)
  402.             if ($discussionClass->getClasse() === $this) {
  403.                 $discussionClass->setClasse(null);
  404.             }
  405.         }
  406.         return $this;
  407.     }
  408.     /**
  409.      * @return Collection<int, SubjectGroup>
  410.      */
  411.     public function getSubjectGroups(): Collection
  412.     {
  413.         return $this->subjectGroups;
  414.     }
  415.     public function addSubjectGroup(SubjectGroup $subjectGroup): static
  416.     {
  417.         if (!$this->subjectGroups->contains($subjectGroup)) {
  418.             $this->subjectGroups->add($subjectGroup);
  419.             $subjectGroup->setClasse($this);
  420.         }
  421.         return $this;
  422.     }
  423.     public function removeSubjectGroup(SubjectGroup $subjectGroup): static
  424.     {
  425.         if ($this->subjectGroups->removeElement($subjectGroup)) {
  426.             // set the owning side to null (unless already changed)
  427.             if ($subjectGroup->getClasse() === $this) {
  428.                 $subjectGroup->setClasse(null);
  429.             }
  430.         }
  431.         return $this;
  432.     }
  433.     /**
  434.      * @return Collection<int, Scolarity>
  435.      */
  436.     public function getScolarities(): Collection
  437.     {
  438.         return $this->scolarities;
  439.     }
  440.     public function addScolarity(Scolarity $scolarity): static
  441.     {
  442.         if (!$this->scolarities->contains($scolarity)) {
  443.             $this->scolarities->add($scolarity);
  444.             $scolarity->setClasse($this);
  445.         }
  446.         return $this;
  447.     }
  448.     public function removeScolarity(Scolarity $scolarity): static
  449.     {
  450.         if ($this->scolarities->removeElement($scolarity)) {
  451.             // set the owning side to null (unless already changed)
  452.             if ($scolarity->getClasse() === $this) {
  453.                 $scolarity->setClasse(null);
  454.             }
  455.         }
  456.         return $this;
  457.     }
  458.     /**
  459.      * @return Collection<int, ExamAgenda>
  460.      */
  461.     public function getExamAgendas(): Collection
  462.     {
  463.         return $this->examAgendas;
  464.     }
  465.     public function addExamAgenda(ExamAgenda $examAgenda): static
  466.     {
  467.         if (!$this->examAgendas->contains($examAgenda)) {
  468.             $this->examAgendas->add($examAgenda);
  469.             $examAgenda->setClasse($this);
  470.         }
  471.         return $this;
  472.     }
  473.     public function removeExamAgenda(ExamAgenda $examAgenda): static
  474.     {
  475.         if ($this->examAgendas->removeElement($examAgenda)) {
  476.             // set the owning side to null (unless already changed)
  477.             if ($examAgenda->getClasse() === $this) {
  478.                 $examAgenda->setClasse(null);
  479.             }
  480.         }
  481.         return $this;
  482.     }
  483.     /**
  484.      * @return Collection<int, SubSequence>
  485.      */
  486.     public function getSubSequences(): Collection
  487.     {
  488.         return $this->subSequences;
  489.     }
  490.     public function addSubSequence(SubSequence $subSequence): static
  491.     {
  492.         if (!$this->subSequences->contains($subSequence)) {
  493.             $this->subSequences->add($subSequence);
  494.             $subSequence->setClasse($this);
  495.         }
  496.         return $this;
  497.     }
  498.     public function removeSubSequence(SubSequence $subSequence): static
  499.     {
  500.         if ($this->subSequences->removeElement($subSequence)) {
  501.             // set the owning side to null (unless already changed)
  502.             if ($subSequence->getClasse() === $this) {
  503.                 $subSequence->setClasse(null);
  504.             }
  505.         }
  506.         return $this;
  507.     }
  508.     /**
  509.      * @return Collection<int, Quarter>
  510.      */
  511.     public function getQuarters(): Collection
  512.     {
  513.         return $this->quarters;
  514.     }
  515.     public function addQuarter(Quarter $quarter): static
  516.     {
  517.         if (!$this->quarters->contains($quarter)) {
  518.             $this->quarters->add($quarter);
  519.             $quarter->setClasse($this);
  520.         }
  521.         return $this;
  522.     }
  523.     public function removeQuarter(Quarter $quarter): static
  524.     {
  525.         if ($this->quarters->removeElement($quarter)) {
  526.             // set the owning side to null (unless already changed)
  527.             if ($quarter->getClasse() === $this) {
  528.                 $quarter->setClasse(null);
  529.             }
  530.         }
  531.         return $this;
  532.     }
  533.     /**
  534.      * @return Collection<int, SubNote>
  535.      */
  536.     public function getSubNotes(): Collection
  537.     {
  538.         return $this->subNotes;
  539.     }
  540.     public function addSubNote(SubNote $subNote): static
  541.     {
  542.         if (!$this->subNotes->contains($subNote)) {
  543.             $this->subNotes->add($subNote);
  544.             $subNote->setClasse($this);
  545.         }
  546.         return $this;
  547.     }
  548.     public function removeSubNote(SubNote $subNote): static
  549.     {
  550.         if ($this->subNotes->removeElement($subNote)) {
  551.             // set the owning side to null (unless already changed)
  552.             if ($subNote->getClasse() === $this) {
  553.                 $subNote->setClasse(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     /**
  559.      * @return Collection<int, Punish>
  560.      */
  561.     public function getPunishes(): Collection
  562.     {
  563.         return $this->punishes;
  564.     }
  565.     public function addPunish(Punish $punish): static
  566.     {
  567.         if (!$this->punishes->contains($punish)) {
  568.             $this->punishes->add($punish);
  569.             $punish->setClass($this);
  570.         }
  571.         return $this;
  572.     }
  573.     /**
  574.      * @return Collection<int, DisciplineWarning>
  575.      */
  576.     public function getDisciplineWarnings(): Collection
  577.     {
  578.         return $this->disciplineWarnings;
  579.     }
  580.     public function addDisciplineWarning(DisciplineWarning $disciplineWarning): static
  581.     {
  582.         if (!$this->disciplineWarnings->contains($disciplineWarning)) {
  583.             $this->disciplineWarnings->add($disciplineWarning);
  584.             $disciplineWarning->setClasse($this);
  585.         }
  586.         return $this;
  587.     }
  588.     public function removePunish(Punish $punish): static
  589.     {
  590.         if ($this->punishes->removeElement($punish)) {
  591.             // set the owning side to null (unless already changed)
  592.             if ($punish->getClass() === $this) {
  593.                 $punish->setClass(null);
  594.             }
  595.             return $this;
  596.         }
  597.     }
  598.     public function removeDisciplineWarning(DisciplineWarning $disciplineWarning): static
  599.     {
  600.         if ($this->disciplineWarnings->removeElement($disciplineWarning)) {
  601.             // set the owning side to null (unless already changed)
  602.             if ($disciplineWarning->getClasse() === $this) {
  603.                 $disciplineWarning->setClasse(null);
  604.             }
  605.         }
  606.         return $this;
  607.     }
  608.     /**
  609.      * @return Collection<int, DisciplineBlame>
  610.      */
  611.     public function getDisciplineBlames(): Collection
  612.     {
  613.         return $this->disciplineBlames;
  614.     }
  615.     public function addDisciplineBlame(DisciplineBlame $disciplineBlame): static
  616.     {
  617.         if (!$this->disciplineBlames->contains($disciplineBlame)) {
  618.             $this->disciplineBlames->add($disciplineBlame);
  619.             $disciplineBlame->setClasse($this);
  620.         }
  621.         return $this;
  622.     }
  623.     public function removeDisciplineBlame(DisciplineBlame $disciplineBlame): static
  624.     {
  625.         if ($this->disciplineBlames->removeElement($disciplineBlame)) {
  626.             // set the owning side to null (unless already changed)
  627.             if ($disciplineBlame->getClasse() === $this) {
  628.                 $disciplineBlame->setClasse(null);
  629.             }
  630.         }
  631.         return $this;
  632.     }
  633.     /**
  634.      * @return Collection<int, DisciplineExclusion>
  635.      */
  636.     public function getDisciplineExclusions(): Collection
  637.     {
  638.         return $this->disciplineExclusions;
  639.     }
  640.     public function addDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  641.     {
  642.         if (!$this->disciplineExclusions->contains($disciplineExclusion)) {
  643.             $this->disciplineExclusions->add($disciplineExclusion);
  644.             $disciplineExclusion->setClasse($this);
  645.         }
  646.         return $this;
  647.     }
  648.     public function removeDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  649.     {
  650.         if ($this->disciplineExclusions->removeElement($disciplineExclusion)) {
  651.             // set the owning side to null (unless already changed)
  652.             if ($disciplineExclusion->getClasse() === $this) {
  653.                 $disciplineExclusion->setClasse(null);
  654.             }
  655.         }
  656.         return $this;
  657.     }
  658.     /**
  659.      * @return Collection<int, ParentNote>
  660.      */
  661.     public function getParentNotes(): Collection
  662.     {
  663.         return $this->parentNotes;
  664.     }
  665.     public function addParentNote(ParentNote $parentNote): static
  666.     {
  667.         if (!$this->parentNotes->contains($parentNote)) {
  668.             $this->parentNotes->add($parentNote);
  669.             $parentNote->setClasse($this);
  670.         }
  671.         return $this;
  672.     }
  673.     public function removeParentNote(ParentNote $parentNote): static
  674.     {
  675.         if ($this->parentNotes->removeElement($parentNote)) {
  676.             // set the owning side to null (unless already changed)
  677.             if ($parentNote->getClasse() === $this) {
  678.                 $parentNote->setClasse(null);
  679.             }
  680.         }
  681.         return $this;
  682.     }
  683.     /**
  684.      * @return Collection<int, Absence>
  685.      */
  686.     public function getAbsences(): Collection
  687.     {
  688.         return $this->absences;
  689.     }
  690.     public function addAbsence(Absence $absence): static
  691.     {
  692.         if (!$this->absences->contains($absence)) {
  693.             $this->absences->add($absence);
  694.             $absence->setClasse($this);
  695.         }
  696.         return $this;
  697.     }
  698.     public function removeAbsence(Absence $absence): static
  699.     {
  700.         if ($this->absences->removeElement($absence)) {
  701.             // set the owning side to null (unless already changed)
  702.             if ($absence->getClasse() === $this) {
  703.                 $absence->setClasse(null);
  704.             }
  705.         }
  706.         return $this;
  707.     }
  708.     /**
  709.      * @return Collection<int, DisciplineRetained>
  710.      */
  711.     public function getDisciplineRetaineds(): Collection
  712.     {
  713.         return $this->disciplineRetaineds;
  714.     }
  715.     public function addDisciplineRetained(DisciplineRetained $disciplineRetained): static
  716.     {
  717.         if (!$this->disciplineRetaineds->contains($disciplineRetained)) {
  718.             $this->disciplineRetaineds->add($disciplineRetained);
  719.             $disciplineRetained->setClasse($this);
  720.         }
  721.         return $this;
  722.     }
  723.     public function removeDisciplineRetained(DisciplineRetained $disciplineRetained): static
  724.     {
  725.         if ($this->disciplineRetaineds->removeElement($disciplineRetained)) {
  726.             // set the owning side to null (unless already changed)
  727.             if ($disciplineRetained->getClasse() === $this) {
  728.                 $disciplineRetained->setClasse(null);
  729.             }
  730.         }
  731.         return $this;
  732.     }
  733.     public function getProf(): ?User
  734.     {
  735.         return $this->prof;
  736.     }
  737.     public function setProf(?User $prof): static
  738.     {
  739.         $this->prof $prof;
  740.         return $this;
  741.     }
  742.     /**
  743.      * @return Collection<int, PrimaryParentNote>
  744.      */
  745.     public function getPrimaryParentNotes(): Collection
  746.     {
  747.         return $this->primaryParentNotes;
  748.     }
  749.     public function addPrimaryParentNote(PrimaryParentNote $primaryParentNote): static
  750.     {
  751.         if (!$this->primaryParentNotes->contains($primaryParentNote)) {
  752.             $this->primaryParentNotes->add($primaryParentNote);
  753.             $primaryParentNote->setClasse($this);
  754.         }
  755.         return $this;
  756.     }
  757.     public function removePrimaryParentNote(PrimaryParentNote $primaryParentNote): static
  758.     {
  759.         if ($this->primaryParentNotes->removeElement($primaryParentNote)) {
  760.             // set the owning side to null (unless already changed)
  761.             if ($primaryParentNote->getClasse() === $this) {
  762.                 $primaryParentNote->setClasse(null);
  763.             }
  764.         }
  765.         return $this;
  766.     }
  767.     /**
  768.      * @return Collection<int, PrimaryNote>
  769.      */
  770.     public function getPrimaryNotes(): Collection
  771.     {
  772.         return $this->primaryNotes;
  773.     }
  774.     public function addPrimaryNote(PrimaryNote $primaryNote): static
  775.     {
  776.         if (!$this->primaryNotes->contains($primaryNote)) {
  777.             $this->primaryNotes->add($primaryNote);
  778.             $primaryNote->setClasse($this);
  779.         }
  780.         return $this;
  781.     }
  782.     public function removePrimaryNote(PrimaryNote $primaryNote): static
  783.     {
  784.         if ($this->primaryNotes->removeElement($primaryNote)) {
  785.             // set the owning side to null (unless already changed)
  786.             if ($primaryNote->getClasse() === $this) {
  787.                 $primaryNote->setClasse(null);
  788.             }
  789.         }
  790.         return $this;
  791.     }
  792.     /**
  793.      * @return Collection<int, DisciplinePunish>
  794.      */
  795.     public function getDisciplinePunishes(): Collection
  796.     {
  797.         return $this->disciplinePunishes;
  798.     }
  799.     public function addDisciplinePunish(DisciplinePunish $disciplinePunish): static
  800.     {
  801.         if (!$this->disciplinePunishes->contains($disciplinePunish)) {
  802.             $this->disciplinePunishes->add($disciplinePunish);
  803.             $disciplinePunish->setClasse($this);
  804.         }
  805.         return $this;
  806.     }
  807.     public function removeDisciplinePunish(DisciplinePunish $disciplinePunish): static
  808.     {
  809.         if ($this->disciplinePunishes->removeElement($disciplinePunish)) {
  810.             // set the owning side to null (unless already changed)
  811.             if ($disciplinePunish->getClasse() === $this) {
  812.                 $disciplinePunish->setClasse(null);
  813.             }
  814.         }
  815.         return $this;
  816.     }
  817.     /**
  818.      * @return Collection<int, Late>
  819.      */
  820.     public function getLates(): Collection
  821.     {
  822.         return $this->lates;
  823.     }
  824.     public function addLate(Late $late): static
  825.     {
  826.         if (!$this->lates->contains($late)) {
  827.             $this->lates->add($late);
  828.             $late->setClasse($this);
  829.         }
  830.         return $this;
  831.     }
  832.     public function removeLate(Late $late): static
  833.     {
  834.         if ($this->lates->removeElement($late)) {
  835.             // set the owning side to null (unless already changed)
  836.             if ($late->getClasse() === $this) {
  837.                 $late->setClasse(null);
  838.             }
  839.         }
  840.         return $this;
  841.     }
  842.     /**
  843.      * @return Collection<int, Blame>
  844.      */
  845.     public function getBlames(): Collection
  846.     {
  847.         return $this->blames;
  848.     }
  849.     public function addBlame(Blame $blame): static
  850.     {
  851.         if (!$this->blames->contains($blame)) {
  852.             $this->blames->add($blame);
  853.             $blame->setClasse($this);
  854.         }
  855.         return $this;
  856.     }
  857.     public function removeBlame(Blame $blame): static
  858.     {
  859.         if ($this->blames->removeElement($blame)) {
  860.             // set the owning side to null (unless already changed)
  861.             if ($blame->getClasse() === $this) {
  862.                 $blame->setClasse(null);
  863.             }
  864.         }
  865.         return $this;
  866.     }
  867.     /**
  868.      * @return Collection<int, Warning>
  869.      */
  870.     public function getWarnings(): Collection
  871.     {
  872.         return $this->warnings;
  873.     }
  874.     public function addWarning(Warning $warning): static
  875.     {
  876.         if (!$this->warnings->contains($warning)) {
  877.             $this->warnings->add($warning);
  878.             $warning->setClasse($this);
  879.         }
  880.         return $this;
  881.     }
  882.     public function removeWarning(Warning $warning): static
  883.     {
  884.         if ($this->warnings->removeElement($warning)) {
  885.             // set the owning side to null (unless already changed)
  886.             if ($warning->getClasse() === $this) {
  887.                 $warning->setClasse(null);
  888.             }
  889.         }
  890.         return $this;
  891.     }
  892.     /**
  893.      * @return Collection<int, Retained>
  894.      */
  895.     public function getRetaineds(): Collection
  896.     {
  897.         return $this->retaineds;
  898.     }
  899.     public function addRetained(Retained $retained): static
  900.     {
  901.         if (!$this->retaineds->contains($retained)) {
  902.             $this->retaineds->add($retained);
  903.             $retained->setClasse($this);
  904.         }
  905.         return $this;
  906.     }
  907.     public function removeRetained(Retained $retained): static
  908.     {
  909.         if ($this->retaineds->removeElement($retained)) {
  910.             // set the owning side to null (unless already changed)
  911.             if ($retained->getClasse() === $this) {
  912.                 $retained->setClasse(null);
  913.             }
  914.         }
  915.         return $this;
  916.     }
  917.     public function getSlug(): ?string
  918.     {
  919.         return $this->slug;
  920.     }
  921.     public function setSlug(?string $slug): static
  922.     {
  923.         $this->slug $slug;
  924.         return $this;
  925.     }
  926.     /**
  927.      * @return Collection<int, DisciplineConcile>
  928.      */
  929.     public function getDisciplineConciles(): Collection
  930.     {
  931.         return $this->disciplineConciles;
  932.     }
  933.     public function addDisciplineConcile(DisciplineConcile $disciplineConcile): static
  934.     {
  935.         if (!$this->disciplineConciles->contains($disciplineConcile)) {
  936.             $this->disciplineConciles->add($disciplineConcile);
  937.             $disciplineConcile->setClasse($this);
  938.         }
  939.         return $this;
  940.     }
  941.     public function removeDisciplineConcile(DisciplineConcile $disciplineConcile): static
  942.     {
  943.         if ($this->disciplineConciles->removeElement($disciplineConcile)) {
  944.             // set the owning side to null (unless already changed)
  945.             if ($disciplineConcile->getClasse() === $this) {
  946.                 $disciplineConcile->setClasse(null);
  947.             }
  948.         }
  949.         return $this;
  950.     }
  951.     public function getPrincipalProf(): ?UserYear
  952.     {
  953.         return $this->principalProf;
  954.     }
  955.     public function setPrincipalProf(?UserYear $principalProf): static
  956.     {
  957.         $this->principalProf $principalProf;
  958.         return $this;
  959.     }
  960.     /**
  961.      * @return Collection<int, Competence>
  962.      */
  963.     public function getCompetences(): Collection
  964.     {
  965.         return $this->competences;
  966.     }
  967.     public function addCompetence(Competence $competence): static
  968.     {
  969.         if (!$this->competences->contains($competence)) {
  970.             $this->competences->add($competence);
  971.             $competence->setClasse($this);
  972.         }
  973.         return $this;
  974.     }
  975.     public function removeCompetence(Competence $competence): static
  976.     {
  977.         if ($this->competences->removeElement($competence)) {
  978.             // set the owning side to null (unless already changed)
  979.             if ($competence->getClasse() === $this) {
  980.                 $competence->setClasse(null);
  981.             }
  982.         }
  983.         return $this;
  984.     }
  985.     /**
  986.      * @return Collection<int, WeekSubjectGoal>
  987.      */
  988.     public function getWeekSubjectGoals(): Collection
  989.     {
  990.         return $this->weekSubjectGoals;
  991.     }
  992.     public function addWeekSubjectGoal(WeekSubjectGoal $weekSubjectGoal): static
  993.     {
  994.         if (!$this->weekSubjectGoals->contains($weekSubjectGoal)) {
  995.             $this->weekSubjectGoals->add($weekSubjectGoal);
  996.             $weekSubjectGoal->setClasse($this);
  997.         }
  998.         return $this;
  999.     }
  1000.     public function removeWeekSubjectGoal(WeekSubjectGoal $weekSubjectGoal): static
  1001.     {
  1002.         if ($this->weekSubjectGoals->removeElement($weekSubjectGoal)) {
  1003.             // set the owning side to null (unless already changed)
  1004.             if ($weekSubjectGoal->getClasse() === $this) {
  1005.                 $weekSubjectGoal->setClasse(null);
  1006.             }
  1007.         }
  1008.         return $this;
  1009.     }
  1010.     /**
  1011.      * @return Collection<int, AgendaElement>
  1012.      */
  1013.     public function getAgendaElements(): Collection
  1014.     {
  1015.         return $this->agendaElements;
  1016.     }
  1017.     public function addAgendaElement(AgendaElement $agendaElement): static
  1018.     {
  1019.         if (!$this->agendaElements->contains($agendaElement)) {
  1020.             $this->agendaElements->add($agendaElement);
  1021.             $agendaElement->setClasse($this);
  1022.         }
  1023.         return $this;
  1024.     }
  1025.     public function removeAgendaElement(AgendaElement $agendaElement): static
  1026.     {
  1027.         if ($this->agendaElements->removeElement($agendaElement)) {
  1028.             // set the owning side to null (unless already changed)
  1029.             if ($agendaElement->getClasse() === $this) {
  1030.                 $agendaElement->setClasse(null);
  1031.             }
  1032.         }
  1033.         return $this;
  1034.     }
  1035.     public function getClassLevel(): ?ClassLevel
  1036.     {
  1037.         return $this->classLevel;
  1038.     }
  1039.     public function setClassLevel(?ClassLevel $classLevel): static
  1040.     {
  1041.         $this->classLevel $classLevel;
  1042.         return $this;
  1043.     }
  1044.     // ── ClassOptions (ManyToMany) ──────────────────────────────────────
  1045.     /**
  1046.      * @return Collection<int, ClassOption>
  1047.      */
  1048.     public function getClassOptions(): Collection
  1049.     {
  1050.         return $this->classOptions;
  1051.     }
  1052.     public function addClassOption(ClassOption $classOption): static
  1053.     {
  1054.         if (!$this->classOptions->contains($classOption)) {
  1055.             $this->classOptions->add($classOption);
  1056.             $classOption->addTheClass($this);
  1057.         }
  1058.         return $this;
  1059.     }
  1060.     public function removeClassOption(ClassOption $classOption): static
  1061.     {
  1062.         if ($this->classOptions->removeElement($classOption)) {
  1063.             $classOption->removeTheClass($this);
  1064.         }
  1065.         return $this;
  1066.     }
  1067.     /**
  1068.      * Compatibilité : retourne la première option si elle existe.
  1069.      * Utile pour les vues qui n'affichent qu'une option.
  1070.      */
  1071.     public function getClassOption(): ?ClassOption
  1072.     {
  1073.         return $this->classOptions->first() ?: null;
  1074.     }
  1075.     // ── NextClasses (promotion) ─────────────────────────────────────────
  1076.     /**
  1077.      * @return Collection<int, TheClass>
  1078.      */
  1079.     public function getNextClasses(): Collection
  1080.     {
  1081.         return $this->nextClasses;
  1082.     }
  1083.     public function addNextClass(TheClass $nextClass): static
  1084.     {
  1085.         if (!$this->nextClasses->contains($nextClass)) {
  1086.             $this->nextClasses->add($nextClass);
  1087.         }
  1088.         return $this;
  1089.     }
  1090.     public function removeNextClass(TheClass $nextClass): static
  1091.     {
  1092.         $this->nextClasses->removeElement($nextClass);
  1093.         return $this;
  1094.     }
  1095.     /**
  1096.      * Retourne true si cette classe a exactement 1 classe suivante
  1097.      * (promotion automatique possible).
  1098.      */
  1099.     public function hasSingleNextClass(): bool
  1100.     {
  1101.         return $this->nextClasses->count() === 1;
  1102.     }
  1103. }