/**
  * @EXT\Route(
  *     "/presence/schoolYear_modif/id/{theSchoolYear}",
  *     name="formalibre_school_year_modif",
  *     options={"expose"=true}
  * )
  *
  * @EXT\ParamConverter("user", options={"authenticatedUser" = true})
  *
  * @param User $user
  * @EXT\Template()
  */
 public function SchoolYearModifAction(SchoolYear $theSchoolYear)
 {
     $ModifSchoolYearForm = $this->createFormBuilder()->add('nameModifSchoolYear', 'text')->add('beginDateModifSchoolYear', 'text')->add('endDateModifSchoolYear', 'text')->add('beginHourModifSchoolYear', 'text')->add('endHourModifSchoolYear', 'text')->add('actualModifSchoolYear', 'checkbox', array('required' => false))->add('validerModifSchoolYear', 'submit', array('label' => 'Ajouter'))->getForm();
     $request = $this->getRequest();
     if ($request->getMethod() === 'POST') {
         $ModifSchoolYearForm->handleRequest($request);
         $modifName = $ModifSchoolYearForm->get('nameModifSchoolYear')->getData();
         $modifBeginDate = $ModifSchoolYearForm->get('beginDateModifSchoolYear')->getData();
         $modifEndDate = $ModifSchoolYearForm->get('endDateModifSchoolYear')->getData();
         $modifBeginHour = $ModifSchoolYearForm->get('beginHourModifSchoolYear')->getData();
         $modifEndHour = $ModifSchoolYearForm->get('endHourModifSchoolYear')->getData();
         $modifActual = $ModifSchoolYearForm->get('actualModifSchoolYear')->getData();
         if ($modifActual) {
             $AllSchoolYear = $this->schoolYearRepo->findAll();
             foreach ($AllSchoolYear as $oneSchoolYear) {
                 $oneSchoolYear->setSchoolYearActual(false);
             }
         }
         $beginDateFormat = \DateTime::createFromFormat('d-m-Y', $modifBeginDate);
         $endDateFormat = \DateTime::createFromFormat('d-m-Y', $modifEndDate);
         $beginHourFormat = \DateTime::createFromFormat('H:i', $modifBeginHour);
         $endHourFormat = \DateTime::createFromFormat('H:i', $modifEndHour);
         $theSchoolYear->setSchoolYearName($modifName);
         $theSchoolYear->setSchoolYearBegin($beginDateFormat);
         $theSchoolYear->setSchoolYearEnd($endDateFormat);
         $theSchoolYear->setSchoolDayBeginHour($beginHourFormat);
         $theSchoolYear->setSchoolDayEndHour($endHourFormat);
         $theSchoolYear->setSchoolYearActual($modifActual);
         $this->em->persist($theSchoolYear);
         $this->em->flush();
         return new JsonResponse('success', 200);
     }
     return array('ModifSchoolYearForm' => $ModifSchoolYearForm->createView(), 'theSchoolYear' => $theSchoolYear);
 }