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