src/Entity/Student.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StudentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Entity\Traits\Timestampable;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\HasLifecycleCallbacks]
  11. #[ORM\Entity(repositoryClassStudentRepository::class)]
  12. class Student
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     #[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
  22.     private ?string $firstName null;
  23.     #[ORM\Column(length255)]
  24.     #[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
  25.     private ?string $lastName null;
  26.     #[ORM\Column(length255,nullabletrue)]
  27.     #[Groups(['getLate','getAbsence','note','getBulletin','getStudents'])]
  28.     private ?string $matricule null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $bornLocation null;
  31.     #[ORM\ManyToOne(cascade: ["persist"], inversedBy'students')]
  32.     #[Groups(['getStudents'])]
  33.     private ?User $parent null;
  34.     #[ORM\OneToMany(mappedBy'student'targetEntityStudentYear::class, orphanRemovaltrue)]
  35.     private Collection $studentYears;
  36.     #[ORM\OneToMany(mappedBy'student'targetEntityLate::class, orphanRemovaltrue)]
  37.     private Collection $lates;
  38.     #[ORM\OneToMany(mappedBy'student'targetEntityAbsence::class, orphanRemovaltrue)]
  39.     private Collection $absences;
  40.     #[ORM\OneToMany(mappedBy'student'targetEntityNote::class, orphanRemovaltrue)]
  41.     private Collection $notes;
  42.     #[ORM\Column(length255nullabletrue)]
  43.     private ?string $fullName null;
  44.     #[ORM\ManyToOne(inversedBy'studentsEdited'cascade: ["persist"])]
  45.     private ?User $editor null;
  46.     #[ORM\ManyToOne(inversedBy'studentsCreated'cascade: ["persist"])]
  47.     private ?User $author null;
  48.     
  49.     #[ORM\OneToMany(mappedBy'student'targetEntityPunish::class, orphanRemovaltrue)]
  50.     private Collection $punishes;
  51.     #[ORM\Column(length255)]
  52.     #[Groups(['getStudents'])]
  53.     private ?string $sexe null;
  54.     #[ORM\ManyToOne(inversedBy'students'cascade: ["persist"])]
  55.     private ?School $school null;
  56.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplineWarning::class , orphanRemovaltrue)]
  57.     private Collection $disciplineWarnings;
  58.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplineBlame::class , orphanRemovaltrue)]
  59.     private Collection $disciplineBlames;
  60.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplineExclusion::class , orphanRemovaltrue)]
  61.     private Collection $disciplineExclusions;
  62.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplineRetained::class , orphanRemovaltrue)]
  63.     private Collection $disciplineRetaineds;
  64.     #[ORM\OneToOne(mappedBy'student'cascade: ['persist''remove'])]
  65.     private ?DefinitiveExclusion $definitiveExclusion null;
  66.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplineConcile::class , orphanRemovaltrue)]
  67.     private Collection $disciplineConciles;
  68.     #[ORM\OneToMany(mappedBy'student'targetEntityPrimaryNote::class , orphanRemovaltrue)]
  69.     private Collection $primaryNotes;
  70.     #[ORM\OneToMany(mappedBy'student'targetEntityDisciplinePunish::class , orphanRemovaltrue)]
  71.     private Collection $disciplinePunishes;
  72.     
  73.     #[ORM\Column(length255nullabletrue)]
  74.     private ?string $picture null;
  75.     #[ORM\Column(length255nullabletrue)]
  76.     private ?string $bornArrondissement null;
  77.     #[ORM\Column(length255nullabletrue)]
  78.     private ?string $bornDepartement null;
  79.     #[ORM\OneToMany(mappedBy'student'targetEntityBlame::class , orphanRemovaltrue)]
  80.     private Collection $blames;
  81.     #[ORM\OneToMany(mappedBy'student'targetEntityWarning::class , orphanRemovaltrue)]
  82.     private Collection $warnings;
  83.     #[ORM\OneToMany(mappedBy'student'targetEntityRetained::class , orphanRemovaltrue)]
  84.     private Collection $retaineds;
  85.     #[ORM\Column(length255nullabletrue)]
  86.     private ?string $father null;
  87.     #[ORM\Column(length255nullabletrue)]
  88.     private ?string $mother null;
  89.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  90.     private ?\DateTimeInterface $bornDay null;
  91.     public function __construct()
  92.     {
  93.         $this->studentYears = new ArrayCollection();
  94.         $this->lates = new ArrayCollection();
  95.         $this->absences = new ArrayCollection();
  96.         $this->notes = new ArrayCollection();
  97.         $this->punishes = new ArrayCollection();
  98.         $this->disciplineWarnings = new ArrayCollection();
  99.         $this->disciplineBlames = new ArrayCollection();
  100.         $this->disciplineExclusions = new ArrayCollection();
  101.         $this->disciplineRetaineds = new ArrayCollection();
  102.         $this->disciplineConciles = new ArrayCollection();
  103.         $this->primaryNotes = new ArrayCollection();
  104.         $this->disciplinePunishes = new ArrayCollection();
  105.         $this->blames = new ArrayCollection();
  106.         $this->warnings = new ArrayCollection();
  107.         $this->retaineds = new ArrayCollection();
  108.     }
  109.     public function __toString(): string
  110.     {
  111.         return $this->getFullName();
  112.     }
  113.     
  114.     public function getFullName():string
  115.     {
  116.         return  $this->lastName.' '.$this->firstName;
  117.     }
  118.     public function getId(): ?int
  119.     {
  120.         return $this->id;
  121.     }
  122.     public function getFirstName(): ?string
  123.     {
  124.         return $this->firstName;
  125.     }
  126.     public function setFirstName(string $firstName): static
  127.     {
  128.         $this->firstName $firstName;
  129.         return $this;
  130.     }
  131.     public function getLastName(): ?string
  132.     {
  133.         return $this->lastName;
  134.     }
  135.     public function setLastName(string $lastName): static
  136.     {
  137.         $this->lastName $lastName;
  138.         return $this;
  139.     }
  140.     public function getMatricule(): ?string
  141.     {
  142.         return $this->matricule;
  143.     }
  144.     public function setMatricule(string $matricule): static
  145.     {
  146.         $this->matricule $matricule;
  147.         return $this;
  148.     }
  149.     public function getBornLocation(): ?string
  150.     {
  151.         return $this->bornLocation;
  152.     }
  153.     public function setBornLocation(?string $bornLocation): static
  154.     {
  155.         $this->bornLocation $bornLocation;
  156.         return $this;
  157.     }
  158.     public function getParent(): ?User
  159.     {
  160.         return $this->parent;
  161.     }
  162.     public function setParent(?User $parent): static
  163.     {
  164.         $this->parent $parent;
  165.         return $this;
  166.     }
  167.     /**
  168.      * @return Collection<int, StudentYear>
  169.      */
  170.     public function getStudentYears(): Collection
  171.     {
  172.         return $this->studentYears;
  173.     }
  174.     public function addStudentYear(StudentYear $studentYear): static
  175.     {
  176.         if (!$this->studentYears->contains($studentYear)) {
  177.             $this->studentYears->add($studentYear);
  178.             $studentYear->setStudent($this);
  179.         }
  180.         return $this;
  181.     }
  182.     public function removeStudentYear(StudentYear $studentYear): static
  183.     {
  184.         if ($this->studentYears->removeElement($studentYear)) {
  185.             // set the owning side to null (unless already changed)
  186.             if ($studentYear->getStudent() === $this) {
  187.                 $studentYear->setStudent(null);
  188.             }
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, Late>
  194.      */
  195.     public function getLates(): Collection
  196.     {
  197.         return $this->lates;
  198.     }
  199.     public function addLate(Late $late): static
  200.     {
  201.         if (!$this->lates->contains($late)) {
  202.             $this->lates->add($late);
  203.             $late->setStudent($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removeLate(Late $late): static
  208.     {
  209.         if ($this->lates->removeElement($late)) {
  210.             // set the owning side to null (unless already changed)
  211.             if ($late->getStudent() === $this) {
  212.                 $late->setStudent(null);
  213.             }
  214.         }
  215.         return $this;
  216.     }
  217.     /**
  218.      * @return Collection<int, Absence>
  219.      */
  220.     public function getAbsences(): Collection
  221.     {
  222.         return $this->absences;
  223.     }
  224.     public function addAbsence(Absence $absence): static
  225.     {
  226.         if (!$this->absences->contains($absence)) {
  227.             $this->absences->add($absence);
  228.             $absence->setStudent($this);
  229.         }
  230.         return $this;
  231.     }
  232.     public function removeAbsence(Absence $absence): static
  233.     {
  234.         if ($this->absences->removeElement($absence)) {
  235.             // set the owning side to null (unless already changed)
  236.             if ($absence->getStudent() === $this) {
  237.                 $absence->setStudent(null);
  238.             }
  239.         }
  240.         return $this;
  241.     }
  242.     /**
  243.      * @return Collection<int, Note>
  244.      */
  245.     public function getNotes(): Collection
  246.     {
  247.         return $this->notes;
  248.     }
  249.     public function addNote(Note $note): static
  250.     {
  251.         if (!$this->notes->contains($note)) {
  252.             $this->notes->add($note);
  253.             $note->setStudent($this);
  254.         }
  255.         return $this;
  256.     }
  257.     public function removeNote(Note $note): static
  258.     {
  259.         if ($this->notes->removeElement($note)) {
  260.             // set the owning side to null (unless already changed)
  261.             if ($note->getStudent() === $this) {
  262.                 $note->setStudent(null);
  263.             }
  264.         }
  265.         return $this;
  266.     }
  267.     public function setFullName(?string $fullName): static
  268.     {
  269.         $this->fullName $fullName;
  270.         return $this;
  271.     }
  272.     public function getEditor(): ?User
  273.     {
  274.         return $this->editor;
  275.     }
  276.     public function setEditor(?User $editor): static
  277.     {
  278.         $this->editor $editor;
  279.         return $this;
  280.     }
  281.     /**
  282.      * @return Collection<int, Punish>
  283.      */
  284.     public function getPunishes(): Collection
  285.     {
  286.         return $this->punishes;
  287.     }
  288.     public function addPunishes(Punish $punishDetail): static
  289.     {
  290.         if (!$this->punishes->contains($punishDetail)) {
  291.             $this->punishes->add($punishDetail);
  292.             $punishDetail->setStudent($this);
  293.         }
  294.         return $this;
  295.     }
  296.     
  297.     public function removePunishDetail(Punish $punishes): static
  298.     {
  299.         if ($this->punishes->removeElement($punishes)) {
  300.             // set the owning side to null (unless already changed)
  301.             if ($punishes->getStudent() === $this) {
  302.                 $punishes->setStudent(null);
  303.             }
  304.         }
  305.         return $this;
  306.     }
  307.     public function getAuthor(): ?User
  308.     {
  309.         return $this->author;
  310.     }
  311.     public function setAuthor(?User $author): static
  312.     {
  313.         $this->author $author;
  314.         return $this;
  315.     }
  316.     public function getSexe(): ?string
  317.     {
  318.         return $this->sexe;
  319.     }
  320.     public function setSexe(string $sexe): static
  321.     {
  322.         $this->sexe $sexe;
  323.         return $this;
  324.     }
  325.     public function getSchool(): ?School
  326.     {
  327.         return $this->school;
  328.     }
  329.     public function setSchool(?School $school): static
  330.     {
  331.         $this->school $school;
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, DisciplineWarning>
  336.      */
  337.     public function getDisciplineWarnings(): Collection
  338.     {
  339.         return $this->disciplineWarnings;
  340.     }
  341.     public function addDisciplineWarning(DisciplineWarning $disciplineWarning): static
  342.     {
  343.         if (!$this->disciplineWarnings->contains($disciplineWarning)) {
  344.             $this->disciplineWarnings->add($disciplineWarning);
  345.             $disciplineWarning->setStudent($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeDisciplineWarning(DisciplineWarning $disciplineWarning): static
  350.     {
  351.         if ($this->disciplineWarnings->removeElement($disciplineWarning)) {
  352.             // set the owning side to null (unless already changed)
  353.             if ($disciplineWarning->getStudent() === $this) {
  354.                 $disciplineWarning->setStudent(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     /**
  360.      * @return Collection<int, DisciplineBlame>
  361.      */
  362.     public function getDisciplineBlames(): Collection
  363.     {
  364.         return $this->disciplineBlames;
  365.     }
  366.     public function addDisciplineBlame(DisciplineBlame $disciplineBlame): static
  367.     {
  368.         if (!$this->disciplineBlames->contains($disciplineBlame)) {
  369.             $this->disciplineBlames->add($disciplineBlame);
  370.             $disciplineBlame->setStudent($this);
  371.         }
  372.         return $this;
  373.     }
  374.     public function removeDisciplineBlame(DisciplineBlame $disciplineBlame): static
  375.     {
  376.         if ($this->disciplineBlames->removeElement($disciplineBlame)) {
  377.             // set the owning side to null (unless already changed)
  378.             if ($disciplineBlame->getStudent() === $this) {
  379.                 $disciplineBlame->setStudent(null);
  380.             }
  381.         }
  382.         return $this;
  383.     }
  384.     /**
  385.      * @return Collection<int, DisciplineExclusion>
  386.      */
  387.     public function getDisciplineExclusions(): Collection
  388.     {
  389.         return $this->disciplineExclusions;
  390.     }
  391.     public function addDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  392.     {
  393.         if (!$this->disciplineExclusions->contains($disciplineExclusion)) {
  394.             $this->disciplineExclusions->add($disciplineExclusion);
  395.             $disciplineExclusion->setStudent($this);
  396.         }
  397.         return $this;
  398.     }
  399.     public function removeDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
  400.     {
  401.         if ($this->disciplineExclusions->removeElement($disciplineExclusion)) {
  402.             // set the owning side to null (unless already changed)
  403.             if ($disciplineExclusion->getStudent() === $this) {
  404.                 $disciplineExclusion->setStudent(null);
  405.             }
  406.         }
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return Collection<int, DisciplineRetained>
  411.      */
  412.     public function getDisciplineRetaineds(): Collection
  413.     {
  414.         return $this->disciplineRetaineds;
  415.     }
  416.     public function addDisciplineRetained(DisciplineRetained $disciplineRetained): static
  417.     {
  418.         if (!$this->disciplineRetaineds->contains($disciplineRetained)) {
  419.             $this->disciplineRetaineds->add($disciplineRetained);
  420.             $disciplineRetained->setStudent($this);
  421.         }
  422.         return $this;
  423.     }
  424.     public function removeDisciplineRetained(DisciplineRetained $disciplineRetained): static
  425.     {
  426.         if ($this->disciplineRetaineds->removeElement($disciplineRetained)) {
  427.             // set the owning side to null (unless already changed)
  428.             if ($disciplineRetained->getStudent() === $this) {
  429.                 $disciplineRetained->setStudent(null);
  430.             }
  431.         }
  432.         return $this;
  433.     }
  434.     public function getDefinitiveExclusion(): ?DefinitiveExclusion
  435.     {
  436.         return $this->definitiveExclusion;
  437.     }
  438.     public function setDefinitiveExclusion(DefinitiveExclusion $definitiveExclusion): static
  439.     {
  440.         // set the owning side of the relation if necessary
  441.         if ($definitiveExclusion->getStudent() !== $this) {
  442.             $definitiveExclusion->setStudent($this);
  443.         }
  444.         $this->definitiveExclusion $definitiveExclusion;
  445.         return $this;
  446.     }
  447.     /**
  448.      * @return Collection<int, DisciplineConcile>
  449.      */
  450.     public function getDisciplineConciles(): Collection
  451.     {
  452.         return $this->disciplineConciles;
  453.     }
  454.     public function addDisciplineConcile(DisciplineConcile $disciplineConcile): static
  455.     {
  456.         if (!$this->disciplineConciles->contains($disciplineConcile)) {
  457.             $this->disciplineConciles->add($disciplineConcile);
  458.             $disciplineConcile->setStudent($this);
  459.         }
  460.         return $this;
  461.     }
  462.     public function removeDisciplineConcile(DisciplineConcile $disciplineConcile): static
  463.     {
  464.         if ($this->disciplineConciles->removeElement($disciplineConcile)) {
  465.             // set the owning side to null (unless already changed)
  466.             if ($disciplineConcile->getStudent() === $this) {
  467.                 $disciplineConcile->setStudent(null);
  468.             }
  469.         }
  470.         return $this;
  471.     }
  472.     /**
  473.      * @return Collection<int, PrimaryNote>
  474.      */
  475.     public function getPrimaryNotes(): Collection
  476.     {
  477.         return $this->primaryNotes;
  478.     }
  479.     public function addPrimaryNote(PrimaryNote $primaryNote): static
  480.     {
  481.         if (!$this->primaryNotes->contains($primaryNote)) {
  482.             $this->primaryNotes->add($primaryNote);
  483.             $primaryNote->setStudent($this);
  484.         }
  485.         return $this;
  486.     }
  487.     public function removePrimaryNote(PrimaryNote $primaryNote): static
  488.     {
  489.         if ($this->primaryNotes->removeElement($primaryNote)) {
  490.             // set the owning side to null (unless already changed)
  491.             if ($primaryNote->getStudent() === $this) {
  492.                 $primaryNote->setStudent(null);
  493.             }
  494.         }
  495.         return $this;
  496.     }
  497.     /**
  498.      * @return Collection<int, DisciplinePunish>
  499.      */
  500.     public function getDisciplinePunishes(): Collection
  501.     {
  502.         return $this->disciplinePunishes;
  503.     }
  504.     public function addDisciplinePunish(DisciplinePunish $disciplinePunish): static
  505.     {
  506.         if (!$this->disciplinePunishes->contains($disciplinePunish)) {
  507.             $this->disciplinePunishes->add($disciplinePunish);
  508.             $disciplinePunish->setStudent($this);
  509.         }
  510.         return $this;
  511.     }
  512.     public function removeDisciplinePunish(DisciplinePunish $disciplinePunish): static
  513.     {
  514.         if ($this->disciplinePunishes->removeElement($disciplinePunish)) {
  515.             // set the owning side to null (unless already changed)
  516.             if ($disciplinePunish->getStudent() === $this) {
  517.                 $disciplinePunish->setStudent(null);
  518.             }
  519.         }
  520.         return $this;
  521.     }
  522.     
  523.     public function getPicture(): ?string
  524.     {
  525.         return $this->picture;
  526.     }
  527.     public function setPicture(?string $picture): static
  528.     {
  529.         $this->picture $picture;
  530.         return $this;
  531.     }
  532.     public function getBornArrondissement(): ?string
  533.     {
  534.         return $this->bornArrondissement;
  535.     }
  536.     public function setBornArrondissement(?string $bornArrondissement): static
  537.     {
  538.         $this->bornArrondissement $bornArrondissement;
  539.         return $this;
  540.     }
  541.     public function getBornDepartement(): ?string
  542.     {
  543.         return $this->bornDepartement;
  544.     }
  545.     public function setBornDepartement(?string $bornDepartement): static
  546.     {
  547.         $this->bornDepartement $bornDepartement;
  548.         return $this;
  549.     }
  550.     /**
  551.      * @return Collection<int, Blame>
  552.      */
  553.     public function getBlames(): Collection
  554.     {
  555.         return $this->blames;
  556.     }
  557.     public function addBlame(Blame $blame): static
  558.     {
  559.         if (!$this->blames->contains($blame)) {
  560.             $this->blames->add($blame);
  561.             $blame->setStudent($this);
  562.         }
  563.         return $this;
  564.     }
  565.     public function removeBlame(Blame $blame): static
  566.     {
  567.         if ($this->blames->removeElement($blame)) {
  568.             // set the owning side to null (unless already changed)
  569.             if ($blame->getStudent() === $this) {
  570.                 $blame->setStudent(null);
  571.             }
  572.         }
  573.         return $this;
  574.     }
  575.     /**
  576.      * @return Collection<int, Warning>
  577.      */
  578.     public function getWarnings(): Collection
  579.     {
  580.         return $this->warnings;
  581.     }
  582.     public function addWarning(Warning $warning): static
  583.     {
  584.         if (!$this->warnings->contains($warning)) {
  585.             $this->warnings->add($warning);
  586.             $warning->setStudent($this);
  587.         }
  588.         return $this;
  589.     }
  590.     public function removeWarning(Warning $warning): static
  591.     {
  592.         if ($this->warnings->removeElement($warning)) {
  593.             // set the owning side to null (unless already changed)
  594.             if ($warning->getStudent() === $this) {
  595.                 $warning->setStudent(null);
  596.             }
  597.         }
  598.         return $this;
  599.     }
  600.     /**
  601.      * @return Collection<int, Retained>
  602.      */
  603.     public function getRetaineds(): Collection
  604.     {
  605.         return $this->retaineds;
  606.     }
  607.     public function addRetained(Retained $retained): static
  608.     {
  609.         if (!$this->retaineds->contains($retained)) {
  610.             $this->retaineds->add($retained);
  611.             $retained->setStudent($this);
  612.         }
  613.         return $this;
  614.     }
  615.     public function removeRetained(Retained $retained): static
  616.     {
  617.         if ($this->retaineds->removeElement($retained)) {
  618.             // set the owning side to null (unless already changed)
  619.             if ($retained->getStudent() === $this) {
  620.                 $retained->setStudent(null);
  621.             }
  622.         }
  623.         return $this;
  624.     }
  625.     public function getFather(): ?string
  626.     {
  627.         return $this->father;
  628.     }
  629.     public function setFather(?string $father): static
  630.     {
  631.         $this->father $father;
  632.         return $this;
  633.     }
  634.     public function getMother(): ?string
  635.     {
  636.         return $this->mother;
  637.     }
  638.     public function setMother(?string $mother): static
  639.     {
  640.         $this->mother $mother;
  641.         return $this;
  642.     }
  643.     public function getBornDay(): ?\DateTimeInterface
  644.     {
  645.         return $this->bornDay;
  646.     }
  647.     public function setBornDay(?\DateTimeInterface $bornDay): static
  648.     {
  649.         $this->bornDay $bornDay;
  650.         return $this;
  651.     }
  652. }