diff --git a/src/schedule-2.0/src/Controller/RestController.php b/src/schedule-2.0/src/Controller/RestController.php index 079f8c0..b356fb2 100644 --- a/src/schedule-2.0/src/Controller/RestController.php +++ b/src/schedule-2.0/src/Controller/RestController.php @@ -10,6 +10,7 @@ use Swagger\Annotations as SWG; use App\Entity\Cache; + class RestController extends AbstractFOSRestController { private $output=[]; @@ -19,7 +20,7 @@ class RestController extends AbstractFOSRestController * Return list of maps * * - * @FOSRest\Post("/rest/getBreakdays") + * @FOSRest\Post("/rest/getBreakdays") * @SWG\Response( * response=200, * description="Return list of breakday events" @@ -41,33 +42,33 @@ class RestController extends AbstractFOSRestController * ) */ - public function getBreakdays(Request $request) { + public function getBreakdays(Request $request) { set_time_limit(0); ini_set('memory_limit', '1024M'); - + // Initalisation Manager $em = $this->getDoctrine()->getManager(); // Récupération des parametres $key=$request->get("key"); $username=$request->get("username"); - + if($key!=$this->getParameter("appSecret")) { $view = $this->view("API Key inconnue", 403); - return $this->handleView($view); + return $this->handleView($view); } $user=$em->getRepository("App:User")->findOneBy(["username"=>$username]); if(!$user) { $view = $this->view("User inconnue", 403); - return $this->handleView($view); + return $this->handleView($view); } // On formate le tableau de jour $start=new \Datetime('2022-03-07 00:00'); $end=new \Datetime('00:00'); - $end->modify("last day of this month"); - $end->modify("next sunday"); + $end->modify("last day of this month"); + $end->modify("next sunday"); $events = $em ->createQueryBuilder('event') @@ -99,7 +100,7 @@ class RestController extends AbstractFOSRestController "naturename"=>$event->getTask()->getNature()->getName(), ]; - array_push($output["events"],$tmp); + array_push($output["events"],$tmp); } } @@ -123,10 +124,10 @@ class RestController extends AbstractFOSRestController "naturename"=>"Jour Férié", ]; - array_push($output["events"],$tmp); + array_push($output["events"],$tmp); } - + $view = $this->view($output, 200); - return $this->handleView($view); + return $this->handleView($view); } -} \ No newline at end of file +}