src/Entity/RegistrationStudentRegistration.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RegistrationStudentRegistrationRepository;
  4. use App\Repository\SchoolReportCardRepository;
  5. use DateTimeImmutable;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ORM\Entity(repositoryClass=RegistrationStudentRegistrationRepository::class)
  14.  * Inscrits
  15.  * @Vich\Uploadable
  16.  */
  17. class RegistrationStudentRegistration
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="registrationStudentRegistrations")
  27.      * @ORM\JoinColumn(nullable=false)
  28.      */
  29.     private $establishment;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=RegistrationStudent::class, inversedBy="registrationStudentRegistrations")
  32.      * @ORM\JoinColumn(nullable=false)
  33.      */
  34.     private $student;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity=SchoolYear::class, inversedBy="registrationStudentRegistrations")
  37.      * @ORM\JoinColumn(nullable=false)
  38.      */
  39.     private $schoolYear;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity=SettingClassroom::class, inversedBy="registrationStudentRegistrations")
  42.      * @ORM\JoinColumn(nullable=false)
  43.      */
  44.     private $classroom;
  45.     /**
  46.      * @ORM\Column(type="boolean")
  47.      */
  48.     private $is_redoubling;
  49.     /**
  50.      * @ORM\Column(type="boolean")
  51.      * est boursier
  52.      */
  53.     private $is_diet;
  54.     /**
  55.      * @ORM\Column(type="boolean")
  56.      * est interne
  57.      */
  58.     private $is_internal;
  59.     /**
  60.      * @ORM\Column(type="boolean")
  61.      * est affecte(e)
  62.     */
  63.     private $is_affected;
  64.     /**
  65.      * @ORM\Column(type="date_immutable")
  66.     */
  67.     private $registered_at;
  68.     /**
  69.      * @ORM\Column(type="datetime_immutable")
  70.     */
  71.     private $created_at;
  72.     /**
  73.      * @ORM\Column(type="datetime_immutable")
  74.      */
  75.     private $updated_at;
  76.     /**
  77.      * @ORM\Column(type="integer")
  78.      */
  79.     private $created_by;
  80.     /**
  81.      * @ORM\Column(type="integer")
  82.      */
  83.     private $updated_by;
  84.     /**
  85.      * @ORM\OneToMany(targetEntity=AccountingStudentRegistrationFee::class, mappedBy="studentRegistration")
  86.      */
  87.     private $accountingStudentRegistrationFees;
  88.     /**
  89.      * @ORM\OneToMany(targetEntity=SchoolReportCard::class, mappedBy="studentRegistration")
  90.      * @ORM\OrderBy({"id" = "ASC"})
  91.      */
  92.     private $schoolReportCards;
  93.     /**
  94.      * @ORM\OneToMany(targetEntity=SchoolAverageReportCard::class, mappedBy="studentRegistration")
  95.      */
  96.     private $schoolAverageReportCards;
  97.     /**
  98.      * @ORM\OneToMany(targetEntity=SchoolAssessmentByClass::class, mappedBy="studentRegistration")
  99.      */
  100.     private $schoolAssessmentByClasses;
  101.     /**
  102.      * @ORM\OneToMany(targetEntity=SchoolAssessmentByLevel::class, mappedBy="studentRegistration")
  103.      */
  104.     private $schoolAssessmentByLevels;
  105.     /**
  106.      * @ORM\OneToMany(targetEntity=SchoolAssessmentByClassByMatter::class, mappedBy="studentRegistration")
  107.      */
  108.     private $schoolAssessmentByClassByMatters;
  109.     /**
  110.      * @ORM\OneToMany(targetEntity=SchoolAssessmentByLevelByMatter::class, mappedBy="studentRegistration")
  111.      */
  112.     private $schoolAssessmentByLevelByMatters;
  113.     /**
  114.      * @ORM\OneToMany(targetEntity=AccountingStudentRegistrationPayment::class, mappedBy="studentRegistration")
  115.      */
  116.     private $accountingStudentRegistrationPayments;
  117.     /**
  118.      * @ORM\Column(type="float", nullable=true)
  119.     */
  120.     private $last_amount_paid;
  121.     /**
  122.      * @ORM\Column(type="integer", nullable=true)
  123.     */
  124.     private $last_payment_id;
  125.     /**
  126.      * @ORM\Column(type="datetime_immutable", nullable=true)
  127.     */
  128.     private $last_payment_at;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      */
  132.     private $image;
  133.     /**
  134.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  135.      * 
  136.      * @Vich\UploadableField(mapping="student", fileNameProperty="image")
  137.      * 
  138.      * @var File|null
  139.      * @Assert\File(
  140.      * maxSize = "25M",
  141.      * mimeTypes = {"image/png", "image/jpg", "image/jpeg"},
  142.      * mimeTypesMessage = "Veuillez télécharger une image valide (png, jpg, jpeg)",
  143.      * maxSizeMessage = "Le fichier est trop volumineux ({{size}} {{suffix}}). La taille maximale autorisée est {{limit}} {{suffix}}"
  144.      * )
  145.      */
  146.     private $imageFile;
  147.     /**
  148.      * @ORM\OneToMany(targetEntity=RegistrationClassChange::class, mappedBy="studentRegistration")
  149.      */
  150.     private $registrationClassChanges;
  151.     /**
  152.      * @ORM\OneToMany(targetEntity=RegistrationStudentDowngrade::class, mappedBy="registrationStudentRegistration")
  153.      */
  154.     private $registrationStudentDowngrades;
  155.     /**
  156.      * @ORM\OneToMany(targetEntity=RegistrationStudentAbandonment::class, mappedBy="registrationStudentRegistration")
  157.      */
  158.     private $registrationStudentAbandonments;
  159.     /**
  160.      * @ORM\Column(type="boolean")
  161.     */
  162.     private $is_abandonned;
  163.     /**
  164.      * @ORM\ManyToOne(targetEntity=RegistrationStudentPreRegistration::class, inversedBy="registrationStudentRegistrations")
  165.      */
  166.     private $registrationStudentPreRegistration;
  167.     /**
  168.      * @ORM\OneToMany(targetEntity=RegistrationTransportCheckpoint::class, mappedBy="registrationStudentRegistration")
  169.      */
  170.     private $registrationTransportCheckpoints;
  171.     /**
  172.      * @ORM\Column(type="boolean")
  173.      */
  174.     private $as_food_restrictions;
  175.     /**
  176.      * @ORM\Column(type="boolean")
  177.      */
  178.     private $is_meatless_menu;
  179.     /**
  180.      * @ORM\Column(type="boolean")
  181.      */
  182.     private $is_menu_without_pork;
  183.     /**
  184.      * @ORM\Column(type="boolean")
  185.      */
  186.     private $is_can_eat_alone;
  187.     /**
  188.      * @ORM\Column(type="boolean")
  189.      */
  190.     private $is_can_do_his_business_alone;
  191.     /**
  192.      * @ORM\Column(type="boolean")
  193.      */
  194.     private $is_falls_sleep_easily;
  195.     /**
  196.      * @ORM\OneToMany(targetEntity=SchoolAbsenceAndDelay::class, mappedBy="studentRegistration")
  197.      */
  198.     private $schoolAbsenceAndDelays;
  199.     /**
  200.      * @ORM\ManyToMany(targetEntity=SettingDocumentToProvide::class, inversedBy="registrationStudentRegistrations")
  201.      */
  202.     private $documentProvides;
  203.     /**
  204.      * @ORM\ManyToMany(targetEntity=CommunicationMessage::class, mappedBy="studentRegistrations")
  205.      */
  206.     private $communicationMessages;
  207.     /**
  208.      * @ORM\Column(type="boolean")
  209.     */
  210.     private $is_new;
  211.     /**
  212.      * @ORM\OneToMany(targetEntity=StockStudentKitEntry::class, mappedBy="registrationStudent")
  213.      */
  214.     private $stockStudentKitEntries;
  215.     /**
  216.      * @ORM\OneToMany(targetEntity=StockKitOut::class, mappedBy="registrationStudent")
  217.      */
  218.     private $stockKitOuts;
  219.     /**
  220.      * @ORM\Column(type="string", length=60, nullable=true)
  221.      */
  222.     private $portal_login;
  223.     /**
  224.      * @ORM\Column(type="string", length=60, nullable=true)
  225.      */
  226.     private $portal_password;
  227.     /**
  228.      * @ORM\OneToMany(targetEntity=AccountingCredit::class, mappedBy="studentRegistration")
  229.      */
  230.     private $accountingCredits;
  231.     /**
  232.      * @ORM\OneToMany(targetEntity=SchoolStudentAverage::class, mappedBy="registrationStudentRegistration")
  233.      */
  234.     private $schoolStudentAverages;
  235.     /**
  236.      * @ORM\OneToMany(targetEntity=NurseryTimeSheet::class, mappedBy="registrationStudentRegistration")
  237.      */
  238.     private $nurseryTimeSheets;
  239.     /**
  240.      * @ORM\OneToMany(targetEntity=SchoolTeacherCallSheetLine::class, mappedBy="registrationStudentRegistration")
  241.      */
  242.     private $schoolTeacherCallSheetLines;
  243.     /**
  244.      * @ORM\OneToMany(targetEntity=AccountingChequeTrackingLine::class, mappedBy="registrationStudentRegistration")
  245.      */
  246.     private $accountingChequeTrackingLines;
  247.     /**
  248.      * @ORM\OneToMany(targetEntity=SchoolReportCardAbsence::class, mappedBy="studentRegistration")
  249.      */
  250.     private $schoolReportCardAbsences;
  251.     /**
  252.      * @ORM\OneToMany(targetEntity=WavePayment::class, mappedBy="studentRegistration")
  253.      */
  254.     private $wavePayments;
  255.     public function __construct()
  256.     {
  257.         $this->accountingStudentRegistrationFees = new ArrayCollection();
  258.         $this->schoolReportCards = new ArrayCollection();
  259.         $this->schoolAverageReportCards = new ArrayCollection();
  260.         $this->schoolAssessmentByClasses = new ArrayCollection();
  261.         $this->schoolAssessmentByLevels = new ArrayCollection();
  262.         $this->schoolAssessmentByClassByMatters = new ArrayCollection();
  263.         $this->schoolAssessmentByLevelByMatters = new ArrayCollection();
  264.         $this->is_affected false;
  265.         $this->is_diet false;
  266.         $this->is_internal true;
  267.         $this->is_redoubling false;
  268.         $this->is_abandonned false;
  269.         $this->registered_at = new DateTimeImmutable();
  270.         $this->accountingStudentRegistrationPayments = new ArrayCollection();
  271.         $this->registrationClassChanges = new ArrayCollection();
  272.         $this->registrationStudentDowngrades = new ArrayCollection();
  273.         $this->registrationStudentAbandonments = new ArrayCollection();
  274.         $this->registrationTransportCheckpoints = new ArrayCollection();
  275.         $this->as_food_restrictions false;
  276.         $this->is_meatless_menu false;
  277.         $this->is_menu_without_pork false;
  278.         $this->is_can_eat_alone true;
  279.         $this->is_can_do_his_business_alone true;
  280.         $this->is_falls_sleep_easily false;
  281.         $this->schoolAbsenceAndDelays = new ArrayCollection();
  282.         $this->documentProvides = new ArrayCollection();
  283.         $this->communicationMessages = new ArrayCollection();
  284.         $this->is_new false;
  285.         $this->stockStudentKitEntries = new ArrayCollection();
  286.         $this->stockKitOuts = new ArrayCollection();
  287.         $this->accountingCredits = new ArrayCollection();
  288.         $this->schoolStudentAverages = new ArrayCollection();
  289.         $this->nurseryTimeSheets = new ArrayCollection();
  290.         $this->schoolTeacherCallSheetLines = new ArrayCollection();
  291.         $this->accountingChequeTrackingLines = new ArrayCollection();
  292.         $this->schoolReportCardAbsences = new ArrayCollection();
  293.         $this->wavePayments = new ArrayCollection();
  294.     }
  295.     public function getName()
  296.     {
  297.         return $this->getStudent()->getName();
  298.     }
  299.     public function __toString()
  300.     {
  301.         return $this->getName().' ['.$this->getClassroom()->getLabel().']'.' ['.$this->getStudent()->getRegistrationNumber().']';
  302.     }
  303.     /**
  304.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  305.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  306.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  307.      * must be able to accept an instance of 'File' as the bundle will inject one here
  308.      * during Doctrine hydration.
  309.      *
  310.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  311.      */
  312.     public function setImageFile(?File $imageFile null): void
  313.     {
  314.         $this->imageFile $imageFile;
  315.         if (null !== $imageFile) {
  316.             // It is required that at least one field changes if you are using doctrine
  317.             // otherwise the event listeners won't be called and the file is lost
  318.             $this->updated_at = new \DateTimeImmutable();
  319.         }
  320.     }
  321.     public function getImageFile(): ?File
  322.     {
  323.         return $this->imageFile;
  324.     }
  325.     public function getId(): ?int
  326.     {
  327.         return $this->id;
  328.     }
  329.     public function getEstablishment(): ?Establishment
  330.     {
  331.         return $this->establishment;
  332.     }
  333.     public function setEstablishment(?Establishment $establishment): self
  334.     {
  335.         $this->establishment $establishment;
  336.         return $this;
  337.     }
  338.     public function getStudent(): ?RegistrationStudent
  339.     {
  340.         return $this->student;
  341.     }
  342.     public function setStudent(?RegistrationStudent $student): self
  343.     {
  344.         $this->student $student;
  345.         return $this;
  346.     }
  347.     public function getSchoolYear(): ?SchoolYear
  348.     {
  349.         return $this->schoolYear;
  350.     }
  351.     public function setSchoolYear(?SchoolYear $schoolYear): self
  352.     {
  353.         $this->schoolYear $schoolYear;
  354.         return $this;
  355.     }
  356.     public function getClassroom(): ?SettingClassroom
  357.     {
  358.         return $this->classroom;
  359.     }
  360.     public function setClassroom(?SettingClassroom $classroom): self
  361.     {
  362.         $this->classroom $classroom;
  363.         return $this;
  364.     }
  365.     public function getCreatedAt(): ?\DateTimeImmutable
  366.     {
  367.         return $this->created_at;
  368.     }
  369.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  370.     {
  371.         $this->created_at $created_at;
  372.         return $this;
  373.     }
  374.     public function getUpdatedAt(): ?\DateTimeImmutable
  375.     {
  376.         return $this->updated_at;
  377.     }
  378.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  379.     {
  380.         $this->updated_at $updated_at;
  381.         return $this;
  382.     }
  383.     public function getCreatedBy(): ?int
  384.     {
  385.         return $this->created_by;
  386.     }
  387.     public function setCreatedBy(int $created_by): self
  388.     {
  389.         $this->created_by $created_by;
  390.         return $this;
  391.     }
  392.     public function getUpdatedBy(): ?int
  393.     {
  394.         return $this->updated_by;
  395.     }
  396.     public function setUpdatedBy(int $updated_by): self
  397.     {
  398.         $this->updated_by $updated_by;
  399.         return $this;
  400.     }
  401.     /**
  402.      * @return Collection|AccountingStudentRegistrationFee[]
  403.      */
  404.     public function getAccountingStudentRegistrationFees(): Collection
  405.     {
  406.         return $this->accountingStudentRegistrationFees;
  407.     }
  408.     public function addAccountingStudentRegistrationFee(AccountingStudentRegistrationFee $accountingStudentRegistrationFee): self
  409.     {
  410.         if (!$this->accountingStudentRegistrationFees->contains($accountingStudentRegistrationFee)) {
  411.             $this->accountingStudentRegistrationFees[] = $accountingStudentRegistrationFee;
  412.             $accountingStudentRegistrationFee->setStudentRegistration($this);
  413.         }
  414.         return $this;
  415.     }
  416.     public function removeAccountingStudentRegistrationFee(AccountingStudentRegistrationFee $accountingStudentRegistrationFee): self
  417.     {
  418.         if ($this->accountingStudentRegistrationFees->removeElement($accountingStudentRegistrationFee)) {
  419.             // set the owning side to null (unless already changed)
  420.             if ($accountingStudentRegistrationFee->getStudentRegistration() === $this) {
  421.                 $accountingStudentRegistrationFee->setStudentRegistration(null);
  422.             }
  423.         }
  424.         return $this;
  425.     }
  426.     /**
  427.      * @return Collection|SchoolReportCard[]
  428.      */
  429.     public function getSchoolReportCards(): Collection
  430.     {
  431.         return $this->schoolReportCards;
  432.     }
  433.     public function addSchoolReportCard(SchoolReportCard $schoolReportCard): self
  434.     {
  435.         if (!$this->schoolReportCards->contains($schoolReportCard)) {
  436.             $this->schoolReportCards[] = $schoolReportCard;
  437.             $schoolReportCard->setStudentRegistration($this);
  438.         }
  439.         return $this;
  440.     }
  441.    
  442.     public function getOrderedSchoolReportCards(SchoolReportCardRepository $schoolReportCardRepository)
  443.     {
  444.         $schoolReportCards $schoolReportCardRepository->createQueryBuilder('entity')
  445.         ->innerJoin('entity.schoolYearPeriode''schoolYearPeriode')
  446.         ->addSelect('schoolYearPeriode')
  447.         ->andWhere('entity.studentRegistration = :studentRegistration')
  448.         ->setParameter('studentRegistration'$this)
  449.         ->orderBy('schoolYearPeriode.code''ASC')
  450.         ->getQuery()
  451.         ->getResult();
  452.         return $schoolReportCards;
  453.     }
  454.     public function removeSchoolReportCard(SchoolReportCard $schoolReportCard): self
  455.     {
  456.         if ($this->schoolReportCards->removeElement($schoolReportCard)) {
  457.             // set the owning side to null (unless already changed)
  458.             if ($schoolReportCard->getStudentRegistration() === $this) {
  459.                 $schoolReportCard->setStudentRegistration(null);
  460.             }
  461.         }
  462.         return $this;
  463.     }
  464.     /**
  465.      * @return Collection|SchoolAverageReportCard[]
  466.      */
  467.     public function getSchoolAverageReportCards(): Collection
  468.     {
  469.         return $this->schoolAverageReportCards;
  470.     }
  471.     public function addSchoolAverageReportCard(SchoolAverageReportCard $schoolAverageReportCard): self
  472.     {
  473.         if (!$this->schoolAverageReportCards->contains($schoolAverageReportCard)) {
  474.             $this->schoolAverageReportCards[] = $schoolAverageReportCard;
  475.             $schoolAverageReportCard->setStudentRegistration($this);
  476.         }
  477.         return $this;
  478.     }
  479.     public function removeSchoolAverageReportCard(SchoolAverageReportCard $schoolAverageReportCard): self
  480.     {
  481.         if ($this->schoolAverageReportCards->removeElement($schoolAverageReportCard)) {
  482.             // set the owning side to null (unless already changed)
  483.             if ($schoolAverageReportCard->getStudentRegistration() === $this) {
  484.                 $schoolAverageReportCard->setStudentRegistration(null);
  485.             }
  486.         }
  487.         return $this;
  488.     }
  489.     /**
  490.      * @return Collection|SchoolAssessmentByClass[]
  491.      */
  492.     public function getSchoolAssessmentByClasses(): Collection
  493.     {
  494.         return $this->schoolAssessmentByClasses;
  495.     }
  496.     public function addSchoolAssessmentByClass(SchoolAssessmentByClass $schoolAssessmentByClass): self
  497.     {
  498.         if (!$this->schoolAssessmentByClasses->contains($schoolAssessmentByClass)) {
  499.             $this->schoolAssessmentByClasses[] = $schoolAssessmentByClass;
  500.             $schoolAssessmentByClass->setStudentRegistration($this);
  501.         }
  502.         return $this;
  503.     }
  504.     public function removeSchoolAssessmentByClass(SchoolAssessmentByClass $schoolAssessmentByClass): self
  505.     {
  506.         if ($this->schoolAssessmentByClasses->removeElement($schoolAssessmentByClass)) {
  507.             // set the owning side to null (unless already changed)
  508.             if ($schoolAssessmentByClass->getStudentRegistration() === $this) {
  509.                 $schoolAssessmentByClass->setStudentRegistration(null);
  510.             }
  511.         }
  512.         return $this;
  513.     }
  514.     /**
  515.      * @return Collection|SchoolAssessmentByLevel[]
  516.      */
  517.     public function getSchoolAssessmentByLevels(): Collection
  518.     {
  519.         return $this->schoolAssessmentByLevels;
  520.     }
  521.     public function addSchoolAssessmentByLevel(SchoolAssessmentByLevel $schoolAssessmentByLevel): self
  522.     {
  523.         if (!$this->schoolAssessmentByLevels->contains($schoolAssessmentByLevel)) {
  524.             $this->schoolAssessmentByLevels[] = $schoolAssessmentByLevel;
  525.             $schoolAssessmentByLevel->setStudentRegistration($this);
  526.         }
  527.         return $this;
  528.     }
  529.     public function removeSchoolAssessmentByLevel(SchoolAssessmentByLevel $schoolAssessmentByLevel): self
  530.     {
  531.         if ($this->schoolAssessmentByLevels->removeElement($schoolAssessmentByLevel)) {
  532.             // set the owning side to null (unless already changed)
  533.             if ($schoolAssessmentByLevel->getStudentRegistration() === $this) {
  534.                 $schoolAssessmentByLevel->setStudentRegistration(null);
  535.             }
  536.         }
  537.         return $this;
  538.     }
  539.     /**
  540.      * @return Collection|SchoolAssessmentByClassByMatter[]
  541.      */
  542.     public function getSchoolAssessmentByClassByMatters(): Collection
  543.     {
  544.         return $this->schoolAssessmentByClassByMatters;
  545.     }
  546.     public function addSchoolAssessmentByClassByMatter(SchoolAssessmentByClassByMatter $schoolAssessmentByClassByMatter): self
  547.     {
  548.         if (!$this->schoolAssessmentByClassByMatters->contains($schoolAssessmentByClassByMatter)) {
  549.             $this->schoolAssessmentByClassByMatters[] = $schoolAssessmentByClassByMatter;
  550.             $schoolAssessmentByClassByMatter->setStudentRegistration($this);
  551.         }
  552.         return $this;
  553.     }
  554.     public function removeSchoolAssessmentByClassByMatter(SchoolAssessmentByClassByMatter $schoolAssessmentByClassByMatter): self
  555.     {
  556.         if ($this->schoolAssessmentByClassByMatters->removeElement($schoolAssessmentByClassByMatter)) {
  557.             // set the owning side to null (unless already changed)
  558.             if ($schoolAssessmentByClassByMatter->getStudentRegistration() === $this) {
  559.                 $schoolAssessmentByClassByMatter->setStudentRegistration(null);
  560.             }
  561.         }
  562.         return $this;
  563.     }
  564.     /**
  565.      * @return Collection|SchoolAssessmentByLevelByMatter[]
  566.      */
  567.     public function getSchoolAssessmentByLevelByMatters(): Collection
  568.     {
  569.         return $this->schoolAssessmentByLevelByMatters;
  570.     }
  571.     public function addSchoolAssessmentByLevelByMatter(SchoolAssessmentByLevelByMatter $schoolAssessmentByLevelByMatter): self
  572.     {
  573.         if (!$this->schoolAssessmentByLevelByMatters->contains($schoolAssessmentByLevelByMatter)) {
  574.             $this->schoolAssessmentByLevelByMatters[] = $schoolAssessmentByLevelByMatter;
  575.             $schoolAssessmentByLevelByMatter->setStudentRegistration($this);
  576.         }
  577.         return $this;
  578.     }
  579.     public function removeSchoolAssessmentByLevelByMatter(SchoolAssessmentByLevelByMatter $schoolAssessmentByLevelByMatter): self
  580.     {
  581.         if ($this->schoolAssessmentByLevelByMatters->removeElement($schoolAssessmentByLevelByMatter)) {
  582.             // set the owning side to null (unless already changed)
  583.             if ($schoolAssessmentByLevelByMatter->getStudentRegistration() === $this) {
  584.                 $schoolAssessmentByLevelByMatter->setStudentRegistration(null);
  585.             }
  586.         }
  587.         return $this;
  588.     }
  589.     public function getIsRedoubling(): ?bool
  590.     {
  591.         return $this->is_redoubling;
  592.     }
  593.     public function setIsRedoubling(bool $is_redoubling): self
  594.     {
  595.         $this->is_redoubling $is_redoubling;
  596.         return $this;
  597.     }
  598.     public function getIsDiet(): ?bool
  599.     {
  600.         return $this->is_diet;
  601.     }
  602.     public function setIsDiet(bool $is_diet): self
  603.     {
  604.         $this->is_diet $is_diet;
  605.         return $this;
  606.     }
  607.     public function getIsInternal(): ?bool
  608.     {
  609.         return $this->is_internal;
  610.     }
  611.     public function setIsInternal(bool $is_internal): self
  612.     {
  613.         $this->is_internal $is_internal;
  614.         return $this;
  615.     }
  616.     public function getIsAffected(): ?bool
  617.     {
  618.         return $this->is_affected;
  619.     }
  620.     public function setIsAffected(bool $is_affected): self
  621.     {
  622.         $this->is_affected $is_affected;
  623.         return $this;
  624.     }
  625.     public function getRegisteredAt(): ?\DateTimeImmutable
  626.     {
  627.         return $this->registered_at;
  628.     }
  629.     public function setRegisteredAt(\DateTimeImmutable $registered_at): self
  630.     {
  631.         $this->registered_at $registered_at;
  632.         return $this;
  633.     }
  634.     public function getGleAmount(){
  635.         $amount 0;
  636.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $fee) {
  637.             if (!$fee->getIsArchived()) {
  638.                 $amount $amount $fee->getAmount();
  639.             }
  640.         }
  641.         return $amount;
  642.     }
  643.     public function getAmountPaid(){
  644.         $amount 0;
  645.         foreach ($this->getAccountingStudentRegistrationPayments() as $key => $accountingStudentRegistrationPayment) {
  646.             $amount $amount $accountingStudentRegistrationPayment->getAmount();
  647.         }
  648.         $payArchived 0;
  649.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  650.             if ($accountingStudentRegistrationFee->getIsArchived()) {
  651.                 $payArchived $payArchived $accountingStudentRegistrationFee->getAmountPaid();
  652.             }
  653.             
  654.         }
  655.         return $amount $payArchived;
  656.     }
  657.     public function getAmountCancel(): ?float
  658.     {
  659.         $amountCancel 0;
  660.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  661.             //if (!$accountingStudentRegistrationFee->getIsArchived()) {
  662.                 $amountCancel $amountCancel $accountingStudentRegistrationFee->getAmountReported();
  663.             //}
  664.         }
  665.         
  666.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  667.             if (!$accountingStudentRegistrationFee->getIsArchived()) {
  668.                 $amountCancel $amountCancel $accountingStudentRegistrationFee->getAmountCancel();
  669.             }
  670.         }
  671.         
  672.         return $amountCancel;
  673.     }
  674.     public function getAmountRest(): ?float
  675.     {
  676.         return ($this->getGleAmount() - ($this->getAmountPaid() + $this->getAmountCancel()));
  677.     }
  678.     /**
  679.      * @return Collection|AccountingStudentRegistrationPayment[]
  680.      */
  681.     public function getAccountingStudentRegistrationPayments(): Collection
  682.     {
  683.         return $this->accountingStudentRegistrationPayments;
  684.     }
  685.     public function addAccountingStudentRegistrationPayment(AccountingStudentRegistrationPayment $accountingStudentRegistrationPayment): self
  686.     {
  687.         if (!$this->accountingStudentRegistrationPayments->contains($accountingStudentRegistrationPayment)) {
  688.             $this->accountingStudentRegistrationPayments[] = $accountingStudentRegistrationPayment;
  689.             $accountingStudentRegistrationPayment->setStudentRegistration($this);
  690.         }
  691.         return $this;
  692.     }
  693.     public function removeAccountingStudentRegistrationPayment(AccountingStudentRegistrationPayment $accountingStudentRegistrationPayment): self
  694.     {
  695.         if ($this->accountingStudentRegistrationPayments->removeElement($accountingStudentRegistrationPayment)) {
  696.             // set the owning side to null (unless already changed)
  697.             if ($accountingStudentRegistrationPayment->getStudentRegistration() === $this) {
  698.                 $accountingStudentRegistrationPayment->setStudentRegistration(null);
  699.             }
  700.         }
  701.         return $this;
  702.     }
  703.     public function getLastAmountPaid(): ?float
  704.     {
  705.         return $this->last_amount_paid;
  706.     }
  707.     public function setLastAmountPaid(?float $last_amount_paid): self
  708.     {
  709.         $this->last_amount_paid $last_amount_paid;
  710.         return $this;
  711.     }
  712.     public function getLastPaymentId(): ?int
  713.     {
  714.         return $this->last_payment_id;
  715.     }
  716.     public function setLastPaymentId(?int $last_payment_id): self
  717.     {
  718.         $this->last_payment_id $last_payment_id;
  719.         return $this;
  720.     }
  721.     public function getLastPaymentAt(): ?\DateTimeImmutable
  722.     {
  723.         return $this->last_payment_at;
  724.     }
  725.     public function setLastPaymentAt(?\DateTimeImmutable $last_payment_at): self
  726.     {
  727.         $this->last_payment_at $last_payment_at;
  728.         return $this;
  729.     }
  730.     public function getImage(): ?string
  731.     {
  732.         return $this->image;
  733.     }
  734.     public function setImage(?string $image): self
  735.     {
  736.         $this->image $image;
  737.         return $this;
  738.     }
  739.     /**
  740.      * @return Collection|RegistrationClassChange[]
  741.      */
  742.     public function getRegistrationClassChanges(): Collection
  743.     {
  744.         return $this->registrationClassChanges;
  745.     }
  746.     public function addRegistrationClassChange(RegistrationClassChange $registrationClassChange): self
  747.     {
  748.         if (!$this->registrationClassChanges->contains($registrationClassChange)) {
  749.             $this->registrationClassChanges[] = $registrationClassChange;
  750.             $registrationClassChange->setStudentRegistration($this);
  751.         }
  752.         return $this;
  753.     }
  754.     public function removeRegistrationClassChange(RegistrationClassChange $registrationClassChange): self
  755.     {
  756.         if ($this->registrationClassChanges->removeElement($registrationClassChange)) {
  757.             // set the owning side to null (unless already changed)
  758.             if ($registrationClassChange->getStudentRegistration() === $this) {
  759.                 $registrationClassChange->setStudentRegistration(null);
  760.             }
  761.         }
  762.         return $this;
  763.     }
  764.     /**
  765.      * @return Collection|RegistrationStudentDowngrade[]
  766.      */
  767.     public function getRegistrationStudentDowngrades(): Collection
  768.     {
  769.         return $this->registrationStudentDowngrades;
  770.     }
  771.     public function addRegistrationStudentDowngrade(RegistrationStudentDowngrade $registrationStudentDowngrade): self
  772.     {
  773.         if (!$this->registrationStudentDowngrades->contains($registrationStudentDowngrade)) {
  774.             $this->registrationStudentDowngrades[] = $registrationStudentDowngrade;
  775.             $registrationStudentDowngrade->setRegistrationStudentRegistration($this);
  776.         }
  777.         return $this;
  778.     }
  779.     public function removeRegistrationStudentDowngrade(RegistrationStudentDowngrade $registrationStudentDowngrade): self
  780.     {
  781.         if ($this->registrationStudentDowngrades->removeElement($registrationStudentDowngrade)) {
  782.             // set the owning side to null (unless already changed)
  783.             if ($registrationStudentDowngrade->getRegistrationStudentRegistration() === $this) {
  784.                 $registrationStudentDowngrade->setRegistrationStudentRegistration(null);
  785.             }
  786.         }
  787.         return $this;
  788.     }
  789.     /**
  790.      * @return Collection|RegistrationStudentAbandonment[]
  791.      */
  792.     public function getRegistrationStudentAbandonments(): Collection
  793.     {
  794.         return $this->registrationStudentAbandonments;
  795.     }
  796.     public function addRegistrationStudentAbandonment(RegistrationStudentAbandonment $registrationStudentAbandonment): self
  797.     {
  798.         if (!$this->registrationStudentAbandonments->contains($registrationStudentAbandonment)) {
  799.             $this->registrationStudentAbandonments[] = $registrationStudentAbandonment;
  800.             $registrationStudentAbandonment->setRegistrationStudentRegistration($this);
  801.         }
  802.         return $this;
  803.     }
  804.     public function removeRegistrationStudentAbandonment(RegistrationStudentAbandonment $registrationStudentAbandonment): self
  805.     {
  806.         if ($this->registrationStudentAbandonments->removeElement($registrationStudentAbandonment)) {
  807.             // set the owning side to null (unless already changed)
  808.             if ($registrationStudentAbandonment->getRegistrationStudentRegistration() === $this) {
  809.                 $registrationStudentAbandonment->setRegistrationStudentRegistration(null);
  810.             }
  811.         }
  812.         return $this;
  813.     }
  814.     public function getIsAbandonned(): ?bool
  815.     {
  816.         return $this->is_abandonned;
  817.     }
  818.     public function setIsAbandonned(bool $is_abandonned): self
  819.     {
  820.         $this->is_abandonned $is_abandonned;
  821.         return $this;
  822.     }
  823.     public function getRegistrationStudentPreRegistration(): ?RegistrationStudentPreRegistration
  824.     {
  825.         return $this->registrationStudentPreRegistration;
  826.     }
  827.     public function setRegistrationStudentPreRegistration(?RegistrationStudentPreRegistration $registrationStudentPreRegistration): self
  828.     {
  829.         $this->registrationStudentPreRegistration $registrationStudentPreRegistration;
  830.         return $this;
  831.     }
  832.     /**
  833.      * @return Collection|RegistrationTransportCheckpoint[]
  834.      */
  835.     public function getRegistrationTransportCheckpoints(): Collection
  836.     {
  837.         return $this->registrationTransportCheckpoints;
  838.     }
  839.     public function addRegistrationTransportCheckpoint(RegistrationTransportCheckpoint $registrationTransportCheckpoint): self
  840.     {
  841.         if (!$this->registrationTransportCheckpoints->contains($registrationTransportCheckpoint)) {
  842.             $this->registrationTransportCheckpoints[] = $registrationTransportCheckpoint;
  843.             $registrationTransportCheckpoint->setRegistrationStudentRegistration($this);
  844.         }
  845.         return $this;
  846.     }
  847.     public function removeRegistrationTransportCheckpoint(RegistrationTransportCheckpoint $registrationTransportCheckpoint): self
  848.     {
  849.         if ($this->registrationTransportCheckpoints->removeElement($registrationTransportCheckpoint)) {
  850.             // set the owning side to null (unless already changed)
  851.             if ($registrationTransportCheckpoint->getRegistrationStudentRegistration() === $this) {
  852.                 $registrationTransportCheckpoint->setRegistrationStudentRegistration(null);
  853.             }
  854.         }
  855.         return $this;
  856.     }
  857.     public function hasTransportFee(){
  858.         $reponse false;
  859.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  860.             if ($accountingStudentRegistrationFee->getFee()->getCategory() == SettingFee::TRANSPORT_FEE && !$accountingStudentRegistrationFee->getIsCancel() && $accountingStudentRegistrationFee->getAmountPaid() > && !$accountingStudentRegistrationFee->getIsArchived()) {
  861.                 $reponse true;
  862.                 break;
  863.             }
  864.         }
  865.         return $reponse;
  866.     }
  867.     public function hasGardeMidiFee(){
  868.         $reponse false;
  869.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  870.             if ($accountingStudentRegistrationFee->getFee()->getCategory() == SettingFee::GARDE_MIDI_FEE && !$accountingStudentRegistrationFee->getIsCancel()) {
  871.                 $reponse true;
  872.                 break;
  873.             }
  874.         }
  875.         return $reponse;
  876.     }
  877.     public function hasExtraFee(){
  878.         $reponse false;
  879.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  880.             if ($accountingStudentRegistrationFee->getFee()->getCategory() == SettingFee::ACTIVITE_EXTAT_FEE && !$accountingStudentRegistrationFee->getIsCancel()) {
  881.                 $reponse true;
  882.                 break;
  883.             }
  884.         }
  885.         return $reponse;
  886.     }
  887.     public function hasCanteenFee(){
  888.         $reponse false;
  889.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  890.             if ($accountingStudentRegistrationFee->getFee()->getCategory() == SettingFee::CANTINE_FEE && !$accountingStudentRegistrationFee->getIsCancel()) {
  891.                 $reponse true;
  892.                 break;
  893.             }
  894.         }
  895.         return $reponse;
  896.     }
  897.     public function hasMobileApp(){
  898.         $reponse false;
  899.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  900.             if ($accountingStudentRegistrationFee->getFee()->getCategory() == SettingFee::MOBILE_APP && !$accountingStudentRegistrationFee->getIsCancel()) {
  901.                 $reponse true;
  902.                 break;
  903.             }
  904.         }
  905.         return $reponse;
  906.     }
  907.     public function getAmountDueAt(DateTimeImmutable $dueDate$category '0'){
  908.         
  909.         $amountDue 0;
  910.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  911.             if (!$accountingStudentRegistrationFee->getIsArchived()) {
  912.                 foreach ($accountingStudentRegistrationFee->getAccountingStudentRegistrationFeeSheduls() as $key => $accountingStudentRegistrationFeeShedul) {
  913.                     if ($accountingStudentRegistrationFeeShedul->getDateDue() <= $dueDate && $accountingStudentRegistrationFeeShedul->getAmountRest() >= 0) {
  914.                         if ('0' != $category) {
  915.                             if ($accountingStudentRegistrationFee->getFee()->getCategory() == $category) {
  916.                                 $amountDue $amountDue $accountingStudentRegistrationFeeShedul->getAmountRest();
  917.                             }
  918.                         }else {
  919.                             $amountDue $amountDue $accountingStudentRegistrationFeeShedul->getAmountRest();
  920.                         }
  921.                     }
  922.                 }
  923.             }
  924.         }
  925.         $amountChequeTracking 0;
  926.         foreach ($this->getAccountingChequeTrackingLines() as $key => $accountingChequeTrackingLine) {
  927.             if ($accountingChequeTrackingLine->getAccountingChequeTracking()->getStatus() == AccountingChequeTracking::EN_TRAITEMENT) {
  928.                 $amountChequeTracking += $accountingChequeTrackingLine->getAmount();
  929.             }
  930.         }
  931.         
  932.         return $amountDue $amountChequeTracking;
  933.     }
  934.     public function getAmountDueAtByFee(DateTimeImmutable $dueDateSettingFee $settingFee){
  935.         
  936.         $amountDue 0;
  937.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  938.             if (!$accountingStudentRegistrationFee->getIsArchived()) {
  939.                 foreach ($accountingStudentRegistrationFee->getAccountingStudentRegistrationFeeSheduls() as $key => $accountingStudentRegistrationFeeShedul) {
  940.                     if ($accountingStudentRegistrationFeeShedul->getDateDue() <= $dueDate && $accountingStudentRegistrationFeeShedul->getAmountRest() > 0) {
  941.                         if ($accountingStudentRegistrationFee->getFee() == $settingFee) {
  942.                             $amountDue $amountDue $accountingStudentRegistrationFeeShedul->getAmountRest();
  943.                         }
  944.                     }
  945.                 }
  946.             }
  947.         }
  948.         
  949.         return $amountDue;
  950.     }
  951.     public function getFeeShedulDues(DateTimeImmutable $dueDate){
  952.         $feeShedulDues = new ArrayCollection();
  953.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  954.             if (!$accountingStudentRegistrationFee->getIsArchived()) {
  955.                 foreach ($accountingStudentRegistrationFee->getAccountingStudentRegistrationFeeSheduls() as $key => $accountingStudentRegistrationFeeShedul) {
  956.                     if ($accountingStudentRegistrationFeeShedul->getDateDue() <= $dueDate && $accountingStudentRegistrationFeeShedul->getAmountRest() > 0) {
  957.                         $feeShedulDues->add($accountingStudentRegistrationFeeShedul);
  958.                     }
  959.                 }
  960.             }
  961.         }
  962.         
  963.         return $feeShedulDues;
  964.     }
  965.     public function getAsFoodRestrictions(): ?bool
  966.     {
  967.         return $this->as_food_restrictions;
  968.     }
  969.     public function setAsFoodRestrictions(bool $as_food_restrictions): self
  970.     {
  971.         $this->as_food_restrictions $as_food_restrictions;
  972.         return $this;
  973.     }
  974.     public function getIsMeatlessMenu(): ?bool
  975.     {
  976.         return $this->is_meatless_menu;
  977.     }
  978.     public function setIsMeatlessMenu(bool $is_meatless_menu): self
  979.     {
  980.         $this->is_meatless_menu $is_meatless_menu;
  981.         return $this;
  982.     }
  983.     public function getIsMenuWithoutPork(): ?bool
  984.     {
  985.         return $this->is_menu_without_pork;
  986.     }
  987.     public function setIsMenuWithoutPork(bool $is_menu_without_pork): self
  988.     {
  989.         $this->is_menu_without_pork $is_menu_without_pork;
  990.         return $this;
  991.     }
  992.     public function getIsCanEatAlone(): ?bool
  993.     {
  994.         return $this->is_can_eat_alone;
  995.     }
  996.     public function setIsCanEatAlone(bool $is_can_eat_alone): self
  997.     {
  998.         $this->is_can_eat_alone $is_can_eat_alone;
  999.         return $this;
  1000.     }
  1001.     public function getIsCanDoHisBusinessAlone(): ?bool
  1002.     {
  1003.         return $this->is_can_do_his_business_alone;
  1004.     }
  1005.     public function setIsCanDoHisBusinessAlone(bool $is_can_do_his_business_alone): self
  1006.     {
  1007.         $this->is_can_do_his_business_alone $is_can_do_his_business_alone;
  1008.         return $this;
  1009.     }
  1010.     public function getIsFallsSleepEasily(): ?bool
  1011.     {
  1012.         return $this->is_falls_sleep_easily;
  1013.     }
  1014.     public function setIsFallsSleepEasily(bool $is_falls_sleep_easily): self
  1015.     {
  1016.         $this->is_falls_sleep_easily $is_falls_sleep_easily;
  1017.         return $this;
  1018.     }
  1019.     /**
  1020.      * @return Collection|SchoolAbsenceAndDelay[]
  1021.      */
  1022.     public function getSchoolAbsenceAndDelays(): Collection
  1023.     {
  1024.         return $this->schoolAbsenceAndDelays;
  1025.     }
  1026.     public function addSchoolAbsenceAndDelay(SchoolAbsenceAndDelay $schoolAbsenceAndDelay): self
  1027.     {
  1028.         if (!$this->schoolAbsenceAndDelays->contains($schoolAbsenceAndDelay)) {
  1029.             $this->schoolAbsenceAndDelays[] = $schoolAbsenceAndDelay;
  1030.             $schoolAbsenceAndDelay->setStudentRegistration($this);
  1031.         }
  1032.         return $this;
  1033.     }
  1034.     public function removeSchoolAbsenceAndDelay(SchoolAbsenceAndDelay $schoolAbsenceAndDelay): self
  1035.     {
  1036.         if ($this->schoolAbsenceAndDelays->removeElement($schoolAbsenceAndDelay)) {
  1037.             // set the owning side to null (unless already changed)
  1038.             if ($schoolAbsenceAndDelay->getStudentRegistration() === $this) {
  1039.                 $schoolAbsenceAndDelay->setStudentRegistration(null);
  1040.             }
  1041.         }
  1042.         return $this;
  1043.     }
  1044.     public function getDelayByPeriode(SchoolYearPeriode $schoolYearPeriode){
  1045.         $minute 0;
  1046.         $heure 0;
  1047.         foreach ($this->getSchoolAbsenceAndDelays() as $key => $schoolAbsenceAndDelay) {
  1048.             if ($schoolAbsenceAndDelay->getSchoolYearPeriode() == $schoolYearPeriode) {
  1049.                 if ($schoolAbsenceAndDelay->getSituation() == 'RETARD') {
  1050.                     if ($schoolAbsenceAndDelay->getDurationType() == 'MINUTE') {
  1051.                         $minute += $schoolAbsenceAndDelay->getDuration();
  1052.                     }
  1053.                     if ($schoolAbsenceAndDelay->getDurationType() == 'HEURE') {
  1054.                         $heure += $schoolAbsenceAndDelay->getDuration();
  1055.                     }
  1056.                 }
  1057.             }
  1058.         }
  1059.         $heure ceil($heure + ($minute 60));
  1060.         
  1061.         return $heure;
  1062.     }
  1063.     public function getAbsenceByPeriode(SchoolYearPeriode $schoolYearPeriode){
  1064.         $minute 0;
  1065.         $heure 0;
  1066.         foreach ($this->getSchoolAbsenceAndDelays() as $key => $schoolAbsenceAndDelay) {
  1067.             if ($schoolAbsenceAndDelay->getSchoolYearPeriode() == $schoolYearPeriode) {
  1068.                 if ($schoolAbsenceAndDelay->getSituation() == 'ABSENCE') {
  1069.                     if ($schoolAbsenceAndDelay->getDurationType() == 'MINUTE') {
  1070.                         $minute += $schoolAbsenceAndDelay->getDuration();
  1071.                     }
  1072.                     if ($schoolAbsenceAndDelay->getDurationType() == 'HEURE') {
  1073.                         $heure += $schoolAbsenceAndDelay->getDuration();
  1074.                     }
  1075.                 }
  1076.             }
  1077.         }
  1078.         $heure ceil($heure + ($minute 60));
  1079.         
  1080.         return $heure;
  1081.     }
  1082.     /**
  1083.      * @return Collection|SettingDocumentToProvide[]
  1084.      */
  1085.     public function getDocumentProvides(): Collection
  1086.     {
  1087.         return $this->documentProvides;
  1088.     }
  1089.     public function addDocumentProvide(SettingDocumentToProvide $documentProvide): self
  1090.     {
  1091.         if (!$this->documentProvides->contains($documentProvide)) {
  1092.             $this->documentProvides[] = $documentProvide;
  1093.         }
  1094.         return $this;
  1095.     }
  1096.     public function removeDocumentProvide(SettingDocumentToProvide $documentProvide): self
  1097.     {
  1098.         $this->documentProvides->removeElement($documentProvide);
  1099.         return $this;
  1100.     }
  1101.     /**
  1102.      * @return Collection|CommunicationMessage[]
  1103.      */
  1104.     public function getCommunicationMessages(): Collection
  1105.     {
  1106.         return $this->communicationMessages;
  1107.     }
  1108.     public function addCommunicationMessage(CommunicationMessage $communicationMessage): self
  1109.     {
  1110.         if (!$this->communicationMessages->contains($communicationMessage)) {
  1111.             $this->communicationMessages[] = $communicationMessage;
  1112.             $communicationMessage->addStudentRegistration($this);
  1113.         }
  1114.         return $this;
  1115.     }
  1116.     public function removeCommunicationMessage(CommunicationMessage $communicationMessage): self
  1117.     {
  1118.         if ($this->communicationMessages->removeElement($communicationMessage)) {
  1119.             $communicationMessage->removeStudentRegistration($this);
  1120.         }
  1121.         return $this;
  1122.     }
  1123.     public function getIsNew(): ?bool
  1124.     {
  1125.         return $this->is_new;
  1126.     }
  1127.     public function setIsNew(bool $is_new): self
  1128.     {
  1129.         $this->is_new $is_new;
  1130.         return $this;
  1131.     }
  1132.     /**
  1133.      * @return Collection|StockStudentKitEntry[]
  1134.      */
  1135.     public function getStockStudentKitEntries(): Collection
  1136.     {
  1137.         return $this->stockStudentKitEntries;
  1138.     }
  1139.     public function addStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
  1140.     {
  1141.         if (!$this->stockStudentKitEntries->contains($stockStudentKitEntry)) {
  1142.             $this->stockStudentKitEntries[] = $stockStudentKitEntry;
  1143.             $stockStudentKitEntry->setRegistrationStudent($this);
  1144.         }
  1145.         return $this;
  1146.     }
  1147.     public function removeStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
  1148.     {
  1149.         if ($this->stockStudentKitEntries->removeElement($stockStudentKitEntry)) {
  1150.             // set the owning side to null (unless already changed)
  1151.             if ($stockStudentKitEntry->getRegistrationStudent() === $this) {
  1152.                 $stockStudentKitEntry->setRegistrationStudent(null);
  1153.             }
  1154.         }
  1155.         return $this;
  1156.     }
  1157.     /**
  1158.      * @return Collection|StockKitOut[]
  1159.      */
  1160.     public function getStockKitOuts(): Collection
  1161.     {
  1162.         return $this->stockKitOuts;
  1163.     }
  1164.     public function addStockKitOut(StockKitOut $stockKitOut): self
  1165.     {
  1166.         if (!$this->stockKitOuts->contains($stockKitOut)) {
  1167.             $this->stockKitOuts[] = $stockKitOut;
  1168.             $stockKitOut->setRegistrationStudent($this);
  1169.         }
  1170.         return $this;
  1171.     }
  1172.     public function removeStockKitOut(StockKitOut $stockKitOut): self
  1173.     {
  1174.         if ($this->stockKitOuts->removeElement($stockKitOut)) {
  1175.             // set the owning side to null (unless already changed)
  1176.             if ($stockKitOut->getRegistrationStudent() === $this) {
  1177.                 $stockKitOut->setRegistrationStudent(null);
  1178.             }
  1179.         }
  1180.         return $this;
  1181.     }
  1182.     public function getPortalLogin(): ?string
  1183.     {
  1184.         return $this->portal_login;
  1185.     }
  1186.     public function setPortalLogin(?string $portal_login): self
  1187.     {
  1188.         $this->portal_login $portal_login;
  1189.         return $this;
  1190.     }
  1191.     public function getPortalPassword(): ?string
  1192.     {
  1193.         return $this->portal_password;
  1194.     }
  1195.     public function setPortalPassword(?string $portal_password): self
  1196.     {
  1197.         $this->portal_password $portal_password;
  1198.         return $this;
  1199.     }
  1200.     /**
  1201.      * @return Collection|AccountingCredit[]
  1202.      */
  1203.     public function getAccountingCredits(): Collection
  1204.     {
  1205.         return $this->accountingCredits;
  1206.     }
  1207.     public function addAccountingCredit(AccountingCredit $accountingCredit): self
  1208.     {
  1209.         if (!$this->accountingCredits->contains($accountingCredit)) {
  1210.             $this->accountingCredits[] = $accountingCredit;
  1211.             $accountingCredit->setStudentRegistration($this);
  1212.         }
  1213.         return $this;
  1214.     }
  1215.     public function removeAccountingCredit(AccountingCredit $accountingCredit): self
  1216.     {
  1217.         if ($this->accountingCredits->removeElement($accountingCredit)) {
  1218.             // set the owning side to null (unless already changed)
  1219.             if ($accountingCredit->getStudentRegistration() === $this) {
  1220.                 $accountingCredit->setStudentRegistration(null);
  1221.             }
  1222.         }
  1223.         return $this;
  1224.     }
  1225.     /**
  1226.      * @return Collection|SchoolStudentAverage[]
  1227.      */
  1228.     public function getSchoolStudentAverages(): Collection
  1229.     {
  1230.         return $this->schoolStudentAverages;
  1231.     }
  1232.     public function addSchoolStudentAverage(SchoolStudentAverage $schoolStudentAverage): self
  1233.     {
  1234.         if (!$this->schoolStudentAverages->contains($schoolStudentAverage)) {
  1235.             $this->schoolStudentAverages[] = $schoolStudentAverage;
  1236.             $schoolStudentAverage->setRegistrationStudentRegistration($this);
  1237.         }
  1238.         return $this;
  1239.     }
  1240.     public function removeSchoolStudentAverage(SchoolStudentAverage $schoolStudentAverage): self
  1241.     {
  1242.         if ($this->schoolStudentAverages->removeElement($schoolStudentAverage)) {
  1243.             // set the owning side to null (unless already changed)
  1244.             if ($schoolStudentAverage->getRegistrationStudentRegistration() === $this) {
  1245.                 $schoolStudentAverage->setRegistrationStudentRegistration(null);
  1246.             }
  1247.         }
  1248.         return $this;
  1249.     }
  1250.     public function computePeriodeAverage(SchoolMatter $schoolMatterReportCard $reportCardSchoolAverageReportCard $schoolAverageReportCard){
  1251.         if (count($schoolMatter->getSchoolSubMatters()) > 0) {
  1252.             $averages 0;
  1253.             $periodeAverage 0;
  1254.             $count 0;
  1255.             $coeffecient 0;
  1256.             //foreach ($schoolMatter->getSchoolSubMatters() as $key => $schoolSubMatter) {
  1257.                 foreach ($this->getSchoolStudentAverages() as $key => $schoolStudentAverage) {
  1258.                     if ($schoolStudentAverage->getSchoolAverage()->getIsValidated()) {
  1259.                         $schoolAverageReportCard->setSchoolTeacher($schoolStudentAverage->getSchoolAverage()->getSchoolTeacher());
  1260.                         if (!$schoolStudentAverage->getIsUnclassified()) {
  1261.                             if ($schoolStudentAverage->getSchoolYearPeriode() == $reportCard->getSchoolYearPeriode()) {
  1262.                                 if ($schoolStudentAverage->getSubMatter() != null) {
  1263.                                     if ($schoolStudentAverage->getMatter() == $schoolMatter) {
  1264.                                         $count ++;
  1265.                                         if ($this->getEstablishment()->getType() == Establishment::ESTABLISHMENT_PRESCOLAIRE_PRIMAIRE_TYPES) {
  1266.                                             if($schoolStudentAverage->getNote() < 999){
  1267.                                                 $averages += $schoolStudentAverage->getNote();
  1268.                                                 $coeffecient += ($schoolStudentAverage->getNoteOn() / $reportCard->getNoteOn());
  1269.                                             }
  1270.                                         }else {
  1271.                                             if($schoolStudentAverage->getNote() < 999){
  1272.                                                 $averages += $schoolStudentAverage->getNote() * $schoolStudentAverage->getSubMatter()->getCoefficient();
  1273.                                                 $coeffecient += $schoolStudentAverage->getSubMatter()->getCoefficient();
  1274.                                             }
  1275.                                         }
  1276.                                     }
  1277.                                 }
  1278.                             }
  1279.                         }
  1280.                     }
  1281.                 }
  1282.                 
  1283.                 if ($coeffecient 0) {
  1284.                     $periodeAverage $averages $coeffecient;
  1285.                 }else {
  1286.                     $periodeAverage 999;
  1287.                 }
  1288.                 return $periodeAverage;
  1289.             //}
  1290.         }else {
  1291.             $averages 0;
  1292.             $periodeAverage 0;
  1293.             $count 0;
  1294.             $coeffecient 0;
  1295.             foreach ($this->getSchoolStudentAverages() as $key => $schoolStudentAverage) {
  1296.                 if ($schoolStudentAverage->getSchoolAverage()->getIsValidated()) {
  1297.                     $schoolAverageReportCard->setSchoolTeacher($schoolStudentAverage->getSchoolAverage()->getSchoolTeacher());
  1298.                     if (!$schoolStudentAverage->getIsUnclassified()) {
  1299.                         if ($schoolStudentAverage->getMatter() == $schoolMatter && $schoolStudentAverage->getSchoolYearPeriode() == $reportCard->getSchoolYearPeriode()) {
  1300.                             $count++;
  1301.                             if ($this->getEstablishment()->getType() == Establishment::ESTABLISHMENT_PRESCOLAIRE_PRIMAIRE_TYPES) {
  1302.                                 if($schoolStudentAverage->getNote() < 999){
  1303.                                     $averages += $schoolStudentAverage->getNote();
  1304.                                     $coeffecient += ($schoolStudentAverage->getNoteOn() / $reportCard->getNoteOn());
  1305.                                 }
  1306.                             }else {
  1307.                                 if($schoolStudentAverage->getNote() < 999){
  1308.                                     $averages += $schoolStudentAverage->getNote() * $schoolStudentAverage->getMatter()->getCoefficient();
  1309.                                     $coeffecient += $schoolStudentAverage->getMatter()->getCoefficient();
  1310.                                 }
  1311.                             }
  1312.                         }
  1313.                     }
  1314.                 }
  1315.             }
  1316.             
  1317.             if ($coeffecient 0) {
  1318.                 $periodeAverage $averages $coeffecient;
  1319.             }else {
  1320.                 $periodeAverage 999;
  1321.             }
  1322.             return $periodeAverage;
  1323.         }
  1324.     }
  1325.     public function computeSubPeriodeAverage(SchoolSubMatter $schoolSubMatterReportCard $reportCardSchoolAverageReportCard $schoolAverageReportCard){
  1326.         $averages 0;
  1327.         $periodeAverage 0;
  1328.         $count 0;
  1329.         $coeffecient 0;
  1330.         foreach ($this->getSchoolStudentAverages() as $key => $schoolStudentAverage) {
  1331.             if ($schoolStudentAverage->getSchoolAverage()->getIsValidated()) {
  1332.                 $schoolAverageReportCard->setSchoolTeacher($schoolStudentAverage->getSchoolAverage()->getSchoolTeacher());
  1333.                 if (!$schoolStudentAverage->getIsUnclassified()) {
  1334.                     if ($schoolStudentAverage->getSubMatter() == $schoolSubMatter && $schoolStudentAverage->getSchoolYearPeriode() == $reportCard->getSchoolYearPeriode()) {
  1335.                         $count++;
  1336.                         if ($this->getEstablishment()->getType() == Establishment::ESTABLISHMENT_PRESCOLAIRE_PRIMAIRE_TYPES) {
  1337.                             if($schoolStudentAverage->getNote() < 999){
  1338.                                 $averages += $schoolStudentAverage->getNote();
  1339.                                 $coeffecient += ($schoolStudentAverage->getNoteOn() / $reportCard->getNoteOn());
  1340.                             }
  1341.                         }else {
  1342.                             if($schoolStudentAverage->getNote() < 999){
  1343.                                 $averages += $schoolStudentAverage->getNote() * $schoolSubMatter->getCoefficient();
  1344.                                 $coeffecient += $schoolSubMatter->getCoefficient();
  1345.                             }
  1346.                         }
  1347.                         
  1348.                     }
  1349.                 }
  1350.             }
  1351.         }
  1352.         
  1353.         if ($coeffecient 0) {
  1354.             $periodeAverage $averages $coeffecient;
  1355.         }else {
  1356.             $periodeAverage 999;
  1357.         }
  1358.         return $periodeAverage;
  1359.     }
  1360.     public function asMatterDone(SchoolMatter $schoolMatterReportCard $reportCard){
  1361.         
  1362.         $count 0;
  1363.         foreach ($this->getSchoolStudentAverages() as $key => $schoolStudentAverage) {
  1364.             if ($schoolStudentAverage->getMatter() == $schoolMatter && $schoolStudentAverage->getSchoolYearPeriode() == $reportCard->getSchoolYearPeriode()) {
  1365.                 
  1366.                 $count++;
  1367.             }
  1368.         }
  1369.         return $count 0;
  1370.     }
  1371.     public function getAnnualAverage(): ?float
  1372.     {
  1373.         $annual_average 0;
  1374.         foreach ($this->getSchoolReportCards() as $key => $schoolReportCard) {
  1375.             $annual_average $schoolReportCard->getAnnualAverage();
  1376.         }
  1377.         return $annual_average;
  1378.     }
  1379.     public function getAnnualRank(): ?string
  1380.     {
  1381.         $annual_rank 0;
  1382.         foreach ($this->getSchoolReportCards() as $key => $schoolReportCard) {
  1383.             $annual_rank $schoolReportCard->getAnnualRank();
  1384.         }
  1385.         return $annual_rank;
  1386.     }
  1387.     /**
  1388.      * @return Collection|NurseryTimeSheet[]
  1389.      */
  1390.     public function getNurseryTimeSheets(): Collection
  1391.     {
  1392.         return $this->nurseryTimeSheets;
  1393.     }
  1394.     public function addNurseryTimeSheet(NurseryTimeSheet $nurseryTimeSheet): self
  1395.     {
  1396.         if (!$this->nurseryTimeSheets->contains($nurseryTimeSheet)) {
  1397.             $this->nurseryTimeSheets[] = $nurseryTimeSheet;
  1398.             $nurseryTimeSheet->setRegistrationStudentRegistration($this);
  1399.         }
  1400.         return $this;
  1401.     }
  1402.     public function removeNurseryTimeSheet(NurseryTimeSheet $nurseryTimeSheet): self
  1403.     {
  1404.         if ($this->nurseryTimeSheets->removeElement($nurseryTimeSheet)) {
  1405.             // set the owning side to null (unless already changed)
  1406.             if ($nurseryTimeSheet->getRegistrationStudentRegistration() === $this) {
  1407.                 $nurseryTimeSheet->setRegistrationStudentRegistration(null);
  1408.             }
  1409.         }
  1410.         return $this;
  1411.     }
  1412.     /**
  1413.      * @return Collection|SchoolTeacherCallSheetLine[]
  1414.      */
  1415.     public function getSchoolTeacherCallSheetLines(): Collection
  1416.     {
  1417.         return $this->schoolTeacherCallSheetLines;
  1418.     }
  1419.     public function addSchoolTeacherCallSheetLine(SchoolTeacherCallSheetLine $schoolTeacherCallSheetLine): self
  1420.     {
  1421.         if (!$this->schoolTeacherCallSheetLines->contains($schoolTeacherCallSheetLine)) {
  1422.             $this->schoolTeacherCallSheetLines[] = $schoolTeacherCallSheetLine;
  1423.             $schoolTeacherCallSheetLine->setRegistrationStudentRegistration($this);
  1424.         }
  1425.         return $this;
  1426.     }
  1427.     public function removeSchoolTeacherCallSheetLine(SchoolTeacherCallSheetLine $schoolTeacherCallSheetLine): self
  1428.     {
  1429.         if ($this->schoolTeacherCallSheetLines->removeElement($schoolTeacherCallSheetLine)) {
  1430.             // set the owning side to null (unless already changed)
  1431.             if ($schoolTeacherCallSheetLine->getRegistrationStudentRegistration() === $this) {
  1432.                 $schoolTeacherCallSheetLine->setRegistrationStudentRegistration(null);
  1433.             }
  1434.         }
  1435.         return $this;
  1436.     }
  1437.     public function getJustifydAbsenceByPeriode(SchoolYearPeriode $schoolYearPeriode){
  1438.         $minute 0;
  1439.         $heure 0;
  1440.         foreach ($this->getSchoolAbsenceAndDelays() as $key => $schoolAbsenceAndDelay) {
  1441.             if ($schoolAbsenceAndDelay->getIsJustify()) {
  1442.                 if ($schoolAbsenceAndDelay->getSchoolYearPeriode() == $schoolYearPeriode) {
  1443.                     if ($schoolAbsenceAndDelay->getSituation() == 'ABSENCE') {
  1444.                         if ($schoolAbsenceAndDelay->getDurationType() == 'MINUTE') {
  1445.                             $minute += $schoolAbsenceAndDelay->getDuration();
  1446.                         }
  1447.                         if ($schoolAbsenceAndDelay->getDurationType() == 'HEURE') {
  1448.                             $heure += $schoolAbsenceAndDelay->getDuration();
  1449.                         }
  1450.                     }
  1451.                 }
  1452.             }
  1453.         }
  1454.         $heure ceil($heure + ($minute 60));
  1455.         
  1456.         return $heure;
  1457.     }
  1458.     public function getNotJustifydAbsenceByPeriode(SchoolYearPeriode $schoolYearPeriode){
  1459.         $minute 0;
  1460.         $heure 0;
  1461.         foreach ($this->getSchoolAbsenceAndDelays() as $key => $schoolAbsenceAndDelay) {
  1462.             if (!$schoolAbsenceAndDelay->getIsJustify()) {
  1463.                 if ($schoolAbsenceAndDelay->getSchoolYearPeriode() == $schoolYearPeriode) {
  1464.                     if ($schoolAbsenceAndDelay->getSituation() == 'ABSENCE') {
  1465.                         if ($schoolAbsenceAndDelay->getDurationType() == 'MINUTE') {
  1466.                             $minute += $schoolAbsenceAndDelay->getDuration();
  1467.                         }
  1468.                         if ($schoolAbsenceAndDelay->getDurationType() == 'HEURE') {
  1469.                             $heure += $schoolAbsenceAndDelay->getDuration();
  1470.                         }
  1471.                     }
  1472.                 }
  1473.             }
  1474.         }
  1475.         $heure ceil($heure + ($minute 60));
  1476.         
  1477.         return $heure;
  1478.     }
  1479.     public function isReported(){
  1480.         foreach ($this->getAccountingStudentRegistrationFees() as $key => $accountingStudentRegistrationFee) {
  1481.             if ($accountingStudentRegistrationFee->getIsReported()) {
  1482.                 return true;
  1483.                 break;
  1484.             }
  1485.         }
  1486.         return false;
  1487.     }
  1488.     public function getNurseryPresence(DateTimeImmutable $startDateDateTimeImmutable $endDate){
  1489.         
  1490.         $data = new ArrayCollection();
  1491.         foreach ($this->getSchoolTeacherCallSheetLines() as $key => $schoolTeacherCallSheetLine) {
  1492.             if ($startDate <= $schoolTeacherCallSheetLine->getCreateDate() && $schoolTeacherCallSheetLine->getCreateDate() <= $endDate) {
  1493.                 $data->add($schoolTeacherCallSheetLine);
  1494.             }
  1495.         }
  1496.         return $data;
  1497.     }
  1498.     /**
  1499.      * @return Collection|AccountingChequeTrackingLine[]
  1500.      */
  1501.     public function getAccountingChequeTrackingLines(): Collection
  1502.     {
  1503.         return $this->accountingChequeTrackingLines;
  1504.     }
  1505.     public function addAccountingChequeTrackingLine(AccountingChequeTrackingLine $accountingChequeTrackingLine): self
  1506.     {
  1507.         if (!$this->accountingChequeTrackingLines->contains($accountingChequeTrackingLine)) {
  1508.             $this->accountingChequeTrackingLines[] = $accountingChequeTrackingLine;
  1509.             $accountingChequeTrackingLine->setRegistrationStudentRegistration($this);
  1510.         }
  1511.         return $this;
  1512.     }
  1513.     public function removeAccountingChequeTrackingLine(AccountingChequeTrackingLine $accountingChequeTrackingLine): self
  1514.     {
  1515.         if ($this->accountingChequeTrackingLines->removeElement($accountingChequeTrackingLine)) {
  1516.             // set the owning side to null (unless already changed)
  1517.             if ($accountingChequeTrackingLine->getRegistrationStudentRegistration() === $this) {
  1518.                 $accountingChequeTrackingLine->setRegistrationStudentRegistration(null);
  1519.             }
  1520.         }
  1521.         return $this;
  1522.     }
  1523.     public function getAbsenceStatus($day){
  1524.         $nb 0;
  1525.         foreach ($this->getSchoolTeacherCallSheetLines() as $key => $schoolTeacherCallSheetLine) {
  1526.             //if ($day == $schoolTeacherCallSheetLine->getCreateDate()->format('Y-m-d') && $schoolTeacherCallSheetLine->getSchoolTeacherCallSheet()->getSettingTimeTable() == $settingTimeTable) {
  1527.             if ($day == $schoolTeacherCallSheetLine->getCreateDate()->format('Y-m-d') && $schoolTeacherCallSheetLine->getIsAbsent()) {
  1528.                 $nb++;
  1529.             }
  1530.         }
  1531.         return $nb;
  1532.     }
  1533.     /**
  1534.      * @return Collection|SchoolReportCardAbsence[]
  1535.      */
  1536.     public function getSchoolReportCardAbsences(): Collection
  1537.     {
  1538.         return $this->schoolReportCardAbsences;
  1539.     }
  1540.     public function addSchoolReportCardAbsence(SchoolReportCardAbsence $schoolReportCardAbsence): self
  1541.     {
  1542.         if (!$this->schoolReportCardAbsences->contains($schoolReportCardAbsence)) {
  1543.             $this->schoolReportCardAbsences[] = $schoolReportCardAbsence;
  1544.             $schoolReportCardAbsence->setStudentRegistration($this);
  1545.         }
  1546.         return $this;
  1547.     }
  1548.     public function removeSchoolReportCardAbsence(SchoolReportCardAbsence $schoolReportCardAbsence): self
  1549.     {
  1550.         if ($this->schoolReportCardAbsences->removeElement($schoolReportCardAbsence)) {
  1551.             // set the owning side to null (unless already changed)
  1552.             if ($schoolReportCardAbsence->getStudentRegistration() === $this) {
  1553.                 $schoolReportCardAbsence->setStudentRegistration(null);
  1554.             }
  1555.         }
  1556.         return $this;
  1557.     }
  1558.     /**
  1559.      * @return Collection|WavePayment[]
  1560.      */
  1561.     public function getWavePayments(): Collection
  1562.     {
  1563.         return $this->wavePayments;
  1564.     }
  1565.     public function addWavePayment(WavePayment $wavePayment): self
  1566.     {
  1567.         if (!$this->wavePayments->contains($wavePayment)) {
  1568.             $this->wavePayments[] = $wavePayment;
  1569.             $wavePayment->setStudentRegistration($this);
  1570.         }
  1571.         return $this;
  1572.     }
  1573.     public function removeWavePayment(WavePayment $wavePayment): self
  1574.     {
  1575.         if ($this->wavePayments->removeElement($wavePayment)) {
  1576.             // set the owning side to null (unless already changed)
  1577.             if ($wavePayment->getStudentRegistration() === $this) {
  1578.                 $wavePayment->setStudentRegistration(null);
  1579.             }
  1580.         }
  1581.         return $this;
  1582.     }
  1583. }