src/Entity/Exams.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\ExamsRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\HasLifecycleCallbacks]
  11. #[ORM\Entity(repositoryClassExamsRepository::class)]
  12. class Exams
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['note','getBulletin','getAbsence','getExamStudent','getLate','getPunish''getStatsStudentParentIndex'])]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     #[Groups(['note','getBulletin','getExamStudent','getLate','getAbsence','getPunish''getStatsStudentParentIndex'])]
  22.     private ?string $name null;
  23.     #[ORM\Column]
  24.     #[Groups(['note'])]
  25.     private ?float $coef null;
  26.     #[ORM\OneToMany(mappedBy'exams'targetEntityNote::class)]
  27.     private Collection $notes;
  28.     #[ORM\Column(nullabletrue)]
  29.     #[Groups(['note'])]
  30.     private ?bool $control null;
  31.     #[ORM\ManyToOne(inversedBy'exams'cascade: ["persist"])]
  32.     #[Groups(['note','getBulletin','getExamStudent','getLate','getAbsence','getPunish''getStatsStudentParentIndex'])]
  33.     private ?SchoolYear $year null;
  34.     #[ORM\ManyToOne(inversedBy'exams'cascade: ["persist"])]
  35.     private ?Subject $subject null;
  36.     #[ORM\ManyToOne(inversedBy'exams'cascade: ["persist"])]
  37.     private ?User $author null;
  38.     #[ORM\ManyToOne(inversedBy'examsEdited'cascade: ["persist"])]
  39.     private ?User $editor null;
  40.     #[ORM\OneToMany(mappedBy'exam'targetEntitySubSequence::class, orphanRemovaltrue)]
  41.     private Collection $subSequences;
  42.     #[ORM\ManyToOne(inversedBy'exams')]
  43.     #[ORM\JoinColumn(nullablefalse)]
  44.     private ?Quarter $quarter null;
  45.     #[ORM\OneToMany(mappedBy'exam'targetEntityAbsence::class, orphanRemovaltrue)]
  46.     private Collection $absences;
  47.     #[ORM\OneToMany(mappedBy'exam'targetEntityLate::class, orphanRemovaltrue)]
  48.     private Collection $lates;
  49.     #[ORM\ManyToOne(inversedBy'exams')]
  50.     #[ORM\JoinColumn(nullabletrue)]
  51.     private ?GlobalExam $globalExam null;
  52.     #[ORM\OneToMany(mappedBy'exam'targetEntityParentNote::class)]
  53.     private Collection $parentNotes;
  54.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplineBlame::class)]
  55.     private Collection $disciplineBlames;
  56.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplineWarning::class)]
  57.     private Collection $disciplineWarnings;
  58.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplineRetained::class)]
  59.     private Collection $disciplineRetaineds;
  60.     #[ORM\Column(length255nullabletrue)]
  61.     #[Groups(['note','getBulletin','getExamStudent','getLate','getAbsence','getPunish''getStatsStudentParentIndex'])]
  62.     private ?string $nameEn null;
  63.     #[ORM\Column(nullabletrue)]
  64.     private ?int $type null;
  65.     #[ORM\Column(nullabletrue)]
  66.     private ?int $dividend null;
  67.     #[ORM\Column(length255nullabletrue)]
  68.     private ?string $primaryName null;
  69.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplinePunish::class)]
  70.     private Collection $disciplinePunishes;
  71.     #[ORM\OneToMany(mappedBy'exam'targetEntityRetained::class)]
  72.     private Collection $retaineds;
  73.     #[ORM\Column(length255nullabletrue)]
  74.     #[Groups(['getExamStudent''getStatsStudentParentIndex''getAbsence'])]
  75.     private ?string $slug null;
  76.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplineConcile::class)]
  77.     private Collection $disciplineConciles;
  78.     #[ORM\OneToMany(mappedBy'exam'targetEntityDisciplineExclusion::class)]
  79.     private Collection $disciplineExclusions;
  80.     #[ORM\OneToMany(mappedBy'exam'targetEntityExamWeek::class)]
  81.     private Collection $examWeeks;
  82.     #[ORM\OneToMany(mappedBy'exam'targetEntityCompetence::class)]
  83.     private Collection $competences;
  84.     #[ORM\OneToMany(mappedBy'exam'targetEntityProfSchoolPlanner::class)]
  85.     private Collection $profSchoolPlanners;
  86.     #[ORM\OneToMany(mappedBy'exam'targetEntityProfTime::class)]
  87.     private Collection $profTimes;
  88.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  89.     #[Groups(['getExamStudent''getStatsStudentParentIndex''getAbsence'])]
  90.     private ?\DateTimeInterface $startAt null;
  91.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  92.     #[Groups(['getExamStudent''getStatsStudentParentIndex''getAbsence'])]
  93.     private ?\DateTimeImmutable $endAt null;
  94.     public function __construct()
  95.     {
  96.         $this->notes = new ArrayCollection();
  97.         $this->subSequences = new ArrayCollection();
  98.         $this->absences = new ArrayCollection();
  99.         $this->lates = new ArrayCollection();
  100.         $this->parentNotes = new ArrayCollection();
  101.         $this->disciplineBlames = new ArrayCollection();
  102.         $this->disciplineWarnings = new ArrayCollection();
  103.         $this->disciplineRetaineds = new ArrayCollection();
  104.         $this->disciplinePunishes = new ArrayCollection();
  105.         $this->retaineds = new ArrayCollection();
  106.         $this->disciplineConciles = new ArrayCollection();
  107.         $this->disciplineExclusions = new ArrayCollection();
  108.         $this->examWeeks = new ArrayCollection();
  109.         $this->competences = new ArrayCollection();
  110.         $this->profSchoolPlanners = new ArrayCollection();
  111.         $this->profTimes = new ArrayCollection();
  112.     }
  113.     public function __toString(): string
  114.     {
  115.         return $this->getName();
  116.     }
  117.     public function getId(): ?int
  118.     {
  119.         return $this->id;
  120.     }
  121.     public function getName(): ?string
  122.     {
  123.         return $this->name;
  124.     }
  125.     public function setName(string $name): static
  126.     {
  127.         $this->name $name;
  128.         return $this;
  129.     }
  130.     public function getCoef(): ?float
  131.     {
  132.         return $this->coef;
  133.     }
  134.     public function setCoef(float $coef): static
  135.     {
  136.         $this->coef $coef;
  137.         return $this;
  138.     }
  139.     /**
  140.      * @return Collection<int, Note>
  141.      */
  142.     public function getNotes(): Collection
  143.     {
  144.         return $this->notes;
  145.     }
  146.     public function addNote(Note $note): static
  147.     {
  148.         if (!$this->notes->contains($note)) {
  149.             $this->notes->add($note);
  150.             $note->setExams($this);
  151.         }
  152.         return $this;
  153.     }
  154.     public function removeNote(Note $note): static
  155.     {
  156.         if ($this->notes->removeElement($note)) {
  157.             // set the owning side to null (unless already changed)
  158.             if ($note->getExams() === $this) {
  159.                 $note->setExams(null);
  160.             }
  161.         }
  162.         return $this;
  163.     }
  164.     public function isControl(): ?bool
  165.     {
  166.         return $this->control;
  167.     }
  168.     public function setControl(?bool $control): static
  169.     {
  170.         $this->control $control;
  171.         return $this;
  172.     }
  173.     public function getYear(): ?SchoolYear
  174.     {
  175.         return $this->year;
  176.     }
  177.     public function setYear(?SchoolYear $year): static
  178.     {
  179.         $this->year $year;
  180.         return $this;
  181.     }
  182.     public function getSubject(): ?Subject
  183.     {
  184.         return $this->subject;
  185.     }
  186.     public function setSubject(?Subject $subject): static
  187.     {
  188.         $this->subject $subject;
  189.         return $this;
  190.     }
  191.     public function getAuthor(): ?User
  192.     {
  193.         return $this->author;
  194.     }
  195.     public function setAuthor(?User $author): static
  196.     {
  197.         $this->author $author;
  198.         return $this;
  199.     }
  200.     public function getEditor(): ?User
  201.     {
  202.         return $this->editor;
  203.     }
  204.     public function setEditor(?User $editor): static
  205.     {
  206.         $this->editor $editor;
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return Collection<int, SubSequence>
  211.      */
  212.     public function getSubSequences(): Collection
  213.     {
  214.         return $this->subSequences;
  215.     }
  216.     public function addSubSequence(SubSequence $subSequence): static
  217.     {
  218.         if (!$this->subSequences->contains($subSequence)) {
  219.             $this->subSequences->add($subSequence);
  220.             $subSequence->setExam($this);
  221.         }
  222.         return $this;
  223.     }
  224.     public function removeSubSequence(SubSequence $subSequence): static
  225.     {
  226.         if ($this->subSequences->removeElement($subSequence)) {
  227.             // set the owning side to null (unless already changed)
  228.             if ($subSequence->getExam() === $this) {
  229.                 $subSequence->setExam(null);
  230.             }
  231.         }
  232.         return $this;
  233.     }
  234.     public function getQuarter(): ?Quarter
  235.     {
  236.         return $this->quarter;
  237.     }
  238.     public function setQuarter(?Quarter $quarter): static
  239.     {
  240.         $this->quarter $quarter;
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return Collection<int, Absence>
  245.      */
  246.     public function getAbsences(): Collection
  247.     {
  248.         return $this->absences;
  249.     }
  250.     public function addAbsence(Absence $absence): static
  251.     {
  252.         if (!$this->absences->contains($absence)) {
  253.             $this->absences->add($absence);
  254.             $absence->setExam($this);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeAbsence(Absence $absence): static
  259.     {
  260.         if ($this->absences->removeElement($absence)) {
  261.             // set the owning side to null (unless already changed)
  262.             if ($absence->getExam() === $this) {
  263.                 $absence->setExam(null);
  264.             }
  265.         }
  266.         return $this;
  267.     }
  268.     /**
  269.      * @return Collection<int, Late>
  270.      */
  271.     public function getLates(): Collection
  272.     {
  273.         return $this->lates;
  274.     }
  275.     public function addLate(Late $late): static
  276.     {
  277.         if (!$this->lates->contains($late)) {
  278.             $this->lates->add($late);
  279.             $late->setExam($this);
  280.         }
  281.         return $this;
  282.     }
  283.     public function removeLate(Late $late): static
  284.     {
  285.         if ($this->lates->removeElement($late)) {
  286.             // set the owning side to null (unless already changed)
  287.             if ($late->getExam() === $this) {
  288.                 $late->setExam(null);
  289.             }
  290.         }
  291.         return $this;
  292.     }
  293.     public function getGlobalExam(): ?GlobalExam
  294.     {
  295.         return $this->globalExam;
  296.     }
  297.     public function setGlobalExam(?GlobalExam $globalExam): static
  298.     {
  299.         $this->globalExam $globalExam;
  300.         return $this;
  301.     }
  302.     /**
  303.      * @return Collection<int, ParentNote>
  304.      */
  305.     public function getParentNotes(): Collection
  306.     {
  307.         return $this->parentNotes;
  308.     }
  309.     public function addParentNote(ParentNote $parentNote): static
  310.     {
  311.         if (!$this->parentNotes->contains($parentNote)) {
  312.             $this->parentNotes->add($parentNote);
  313.             $parentNote->setExam($this);
  314.         }
  315.         return $this;
  316.     }
  317.     public function removeParentNote(ParentNote $parentNote): static
  318.     {
  319.         if ($this->parentNotes->removeElement($parentNote)) {
  320.             // set the owning side to null (unless already changed)
  321.             if ($parentNote->getExam() === $this) {
  322.                 $parentNote->setExam(null);
  323.             }
  324.         }
  325.         return $this;
  326.     }
  327.     /**
  328.      * @return Collection<int, DisciplineBlame>
  329.      */
  330.     public function getDisciplineBlames(): Collection
  331.     {
  332.         return $this->disciplineBlames;
  333.     }
  334.     public function addDisciplineBlame(DisciplineBlame $disciplineBlame): static
  335.     {
  336.         if (!$this->disciplineBlames->contains($disciplineBlame)) {
  337.             $this->disciplineBlames->add($disciplineBlame);
  338.             $disciplineBlame->setExam($this);
  339.         }
  340.         return $this;
  341.     }
  342.     public function removeDisciplineBlame(DisciplineBlame $disciplineBlame): static
  343.     {
  344.         if ($this->disciplineBlames->removeElement($disciplineBlame)) {
  345.             // set the owning side to null (unless already changed)
  346.             if ($disciplineBlame->getExam() === $this) {
  347.                 $disciplineBlame->setExam(null);
  348.             }
  349.         }
  350.         return $this;
  351.     }
  352.     /**
  353.      * @return Collection<int, DisciplineWarning>
  354.      */
  355.     public function getDisciplineWarnings(): Collection
  356.     {
  357.         return $this->disciplineWarnings;
  358.     }
  359.     public function addDisciplineWarning(DisciplineWarning $disciplineWarning): static
  360.     {
  361.         if (!$this->disciplineWarnings->contains($disciplineWarning)) {
  362.             $this->disciplineWarnings->add($disciplineWarning);
  363.             $disciplineWarning->setExam($this);
  364.         }
  365.         return $this;
  366.     }
  367.     public function removeDisciplineWarning(DisciplineWarning $disciplineWarning): static
  368.     {
  369.         if ($this->disciplineWarnings->removeElement($disciplineWarning)) {
  370.             // set the owning side to null (unless already changed)
  371.             if ($disciplineWarning->getExam() === $this) {
  372.                 $disciplineWarning->setExam(null);
  373.             }
  374.         }
  375.         return $this;
  376.     }
  377.     /**
  378.      * @return Collection<int, DisciplineRetained>
  379.      */
  380.     public function getDisciplineRetaineds(): Collection
  381.     {
  382.         return $this->disciplineRetaineds;
  383.     }
  384.     public function addDisciplineRetained(DisciplineRetained $disciplineRetained): static
  385.     {
  386.         if (!$this->disciplineRetaineds->contains($disciplineRetained)) {
  387.             $this->disciplineRetaineds->add($disciplineRetained);
  388.             $disciplineRetained->setExam($this);
  389.         }
  390.         return $this;
  391.     }
  392.     public function removeDisciplineRetained(DisciplineRetained $disciplineRetained): static
  393.     {
  394.         if ($this->disciplineRetaineds->removeElement($disciplineRetained)) {
  395.             // set the owning side to null (unless already changed)
  396.             if ($disciplineRetained->getExam() === $this) {
  397.                 $disciplineRetained->setExam(null);
  398.             }
  399.         }
  400.         return $this;
  401.     }
  402.     public function getNameEn(): ?string
  403.     {
  404.         return $this->nameEn;
  405.     }
  406.     public function setNameEn(?string $nameEn): static
  407.     {
  408.         $this->nameEn $nameEn;
  409.         return $this;
  410.     }
  411.     public function getType(): ?int
  412.     {
  413.         return $this->type;
  414.     }
  415.     public function setType(?int $type): static
  416.     {
  417.         $this->type $type;
  418.         return $this;
  419.     }
  420.     public function getDividend(): ?int
  421.     {
  422.         return $this->dividend;
  423.     }
  424.     public function setDividend(?int $dividend): static
  425.     {
  426.         $this->dividend $dividend;
  427.         return $this;
  428.     }
  429.     public function getPrimaryName(): ?string
  430.     {
  431.         return $this->primaryName;
  432.     }
  433.     public function setPrimaryName(?string $primaryName): static
  434.     {
  435.         $this->primaryName $primaryName;
  436.         return $this;
  437.     }
  438.     /**
  439.      * @return Collection<int, DisciplinePunish>
  440.      */
  441.     public function getDisciplinePunishes(): Collection
  442.     {
  443.         return $this->disciplinePunishes;
  444.     }
  445.     public function addDisciplinePunish(DisciplinePunish $disciplinePunish): static
  446.     {
  447.         if (!$this->disciplinePunishes->contains($disciplinePunish)) {
  448.             $this->disciplinePunishes->add($disciplinePunish);
  449.             $disciplinePunish->setExam($this);
  450.         }
  451.         return $this;
  452.     }
  453.     public function removeDisciplinePunish(DisciplinePunish $disciplinePunish): static
  454.     {
  455.         if ($this->disciplinePunishes->removeElement($disciplinePunish)) {
  456.             // set the owning side to null (unless already changed)
  457.             if ($disciplinePunish->getExam() === $this) {
  458.                 $disciplinePunish->setExam(null);
  459.             }
  460.         }
  461.         return $this;
  462.     }
  463.     /**
  464.      * @return Collection<int, Retained>
  465.      */
  466.     public function getRetaineds(): Collection
  467.     {
  468.         return $this->retaineds;
  469.     }
  470.     public function addRetained(Retained $retained): static
  471.     {
  472.         if (!$this->retaineds->contains($retained)) {
  473.             $this->retaineds->add($retained);
  474.             $retained->setExam($this);
  475.         }
  476.         return $this;
  477.     }
  478.     public function removeRetained(Retained $retained): static
  479.     {
  480.         if ($this->retaineds->removeElement($retained)) {
  481.             // set the owning side to null (unless already changed)
  482.             if ($retained->getExam() === $this) {
  483.                 $retained->setExam(null);
  484.             }
  485.         }
  486.         return $this;
  487.     }
  488.     public function getSlug(): ?string
  489.     {
  490.         return $this->slug;
  491.     }
  492.     public function setSlug(?string $slug): static
  493.     {
  494.         $this->slug $slug;
  495.         return $this;
  496.     }
  497.     /**
  498.      * @return Collection<int, DisciplineConcile>
  499.      */
  500.     public function getDisciplineConciles(): Collection
  501.     {
  502.         return $this->disciplineConciles;
  503.     }
  504.     public function addDisciplineConcile(DisciplineConcile $disciplineConcile): static
  505.     {
  506.         if (!$this->disciplineConciles->contains($disciplineConcile)) {
  507.             $this->disciplineConciles->add($disciplineConcile);
  508.             $disciplineConcile->setExam($this);
  509.         }
  510.         return $this;
  511.     }
  512.     public function removeDisciplineConcile(DisciplineConcile $disciplineConcile): static
  513.     {
  514.         if ($this->disciplineConciles->removeElement($disciplineConcile)) {
  515.             // set the owning side to null (unless already changed)
  516.             if ($disciplineConcile->getExam() === $this) {
  517.                 $disciplineConcile->setExam(null);
  518.             }
  519.         }
  520.         return $this;
  521.     }
  522.     /**
  523.      * @return Collection<int, DisciplineExclusion>
  524.      */
  525.     public function getDisciplineExclusions(): Collection
  526.     {
  527.         return $this->disciplineExclusions;
  528.     }
  529.     public function addDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  530.     {
  531.         if (!$this->disciplineExclusions->contains($disciplineExclusion)) {
  532.             $this->disciplineExclusions->add($disciplineExclusion);
  533.             $disciplineExclusion->setExam($this);
  534.         }
  535.         return $this;
  536.     }
  537.     public function removeDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  538.     {
  539.         if ($this->disciplineExclusions->removeElement($disciplineExclusion)) {
  540.             // set the owning side to null (unless already changed)
  541.             if ($disciplineExclusion->getExam() === $this) {
  542.                 $disciplineExclusion->setExam(null);
  543.             }
  544.         }
  545.         return $this;
  546.     }
  547.     /**
  548.      * @return Collection<int, ExamWeek>
  549.      */
  550.     public function getExamWeeks(): Collection
  551.     {
  552.         return $this->examWeeks;
  553.     }
  554.     public function addExamWeek(ExamWeek $examWeek): static
  555.     {
  556.         if (!$this->examWeeks->contains($examWeek)) {
  557.             $this->examWeeks->add($examWeek);
  558.             $examWeek->setExam($this);
  559.         }
  560.         return $this;
  561.     }
  562.     public function removeExamWeek(ExamWeek $examWeek): static
  563.     {
  564.         if ($this->examWeeks->removeElement($examWeek)) {
  565.             // set the owning side to null (unless already changed)
  566.             if ($examWeek->getExam() === $this) {
  567.                 $examWeek->setExam(null);
  568.             }
  569.         }
  570.         return $this;
  571.     }
  572.     /**
  573.      * @return Collection<int, Competence>
  574.      */
  575.     public function getCompetences(): Collection
  576.     {
  577.         return $this->competences;
  578.     }
  579.     public function addCompetence(Competence $competence): static
  580.     {
  581.         if (!$this->competences->contains($competence)) {
  582.             $this->competences->add($competence);
  583.             $competence->setExam($this);
  584.         }
  585.         return $this;
  586.     }
  587.     public function removeCompetence(Competence $competence): static
  588.     {
  589.         if ($this->competences->removeElement($competence)) {
  590.             // set the owning side to null (unless already changed)
  591.             if ($competence->getExam() === $this) {
  592.                 $competence->setExam(null);
  593.             }
  594.         }
  595.         return $this;
  596.     }
  597.     /**
  598.      * @return Collection<int, ProfSchoolPlanner>
  599.      */
  600.     public function getProfSchoolPlanners(): Collection
  601.     {
  602.         return $this->profSchoolPlanners;
  603.     }
  604.     public function addProfSchoolPlanner(ProfSchoolPlanner $profSchoolPlanner): static
  605.     {
  606.         if (!$this->profSchoolPlanners->contains($profSchoolPlanner)) {
  607.             $this->profSchoolPlanners->add($profSchoolPlanner);
  608.             $profSchoolPlanner->setExam($this);
  609.         }
  610.         return $this;
  611.     }
  612.     public function removeProfSchoolPlanner(ProfSchoolPlanner $profSchoolPlanner): static
  613.     {
  614.         if ($this->profSchoolPlanners->removeElement($profSchoolPlanner)) {
  615.             // set the owning side to null (unless already changed)
  616.             if ($profSchoolPlanner->getExam() === $this) {
  617.                 $profSchoolPlanner->setExam(null);
  618.             }
  619.         }
  620.         return $this;
  621.     }
  622.     /**
  623.      * @return Collection<int, ProfTime>
  624.      */
  625.     public function getProfTimes(): Collection
  626.     {
  627.         return $this->profTimes;
  628.     }
  629.     public function addProfTime(ProfTime $profTime): static
  630.     {
  631.         if (!$this->profTimes->contains($profTime)) {
  632.             $this->profTimes->add($profTime);
  633.             $profTime->setExam($this);
  634.         }
  635.         return $this;
  636.     }
  637.     public function removeProfTime(ProfTime $profTime): static
  638.     {
  639.         if ($this->profTimes->removeElement($profTime)) {
  640.             // set the owning side to null (unless already changed)
  641.             if ($profTime->getExam() === $this) {
  642.                 $profTime->setExam(null);
  643.             }
  644.         }
  645.         return $this;
  646.     }
  647.     public function getStartAt(): ?\DateTimeInterface
  648.     {
  649.         return $this->startAt;
  650.     }
  651.     public function setStartAt(?\DateTimeInterface $startAt): static
  652.     {
  653.         $this->startAt $startAt;
  654.         return $this;
  655.     }
  656.     public function getEndAt(): ?\DateTimeImmutable
  657.     {
  658.         return $this->endAt;
  659.     }
  660.     public function setEndAt(?\DateTimeImmutable $endAt): static
  661.     {
  662.         $this->endAt $endAt;
  663.         return $this;
  664.     }
  665. }