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