src/Entity/Exams.php line 14

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