From 9789ff84a9b6b4bc5e33cdf8d16a5496d3489eae Mon Sep 17 00:00:00 2001 From: Bjverde Date: Sat, 24 Sep 2022 00:33:17 -0300 Subject: [PATCH] =?UTF-8?q?:memo:=20APP=20#270=20corre=C3=A7=C3=A3o=20meto?= =?UTF-8?q?do=20PUT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php | 5 ++++- .../api/api_controllers/Acesso_perfil_menuAPI.class.php | 5 ++++- .../api/api_controllers/Acesso_perfil_userAPI.class.php | 5 ++++- appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php b/appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php index 2c1bb0de..f49a34cc 100644 --- a/appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php +++ b/appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php @@ -63,13 +63,16 @@ public static function save(Request $request, Response $response, array $args) { $vo = new \Acesso_menuVO; $msg = \Message::GENERIC_INSERT; - if($request->isPut()){ + if($request->getMethod() == 'PUT'){ $msg = \Message::GENERIC_UPDATE; $result = self::selectByIdInside($args); $bodyRequest = $result[0]; $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); } $bodyRequest = json_decode($request->getBody(),true); + if(empty($bodyRequest)){ + $bodyRequest = $request->getParsedBody(); + } $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); $controller = new \Acesso_menu; diff --git a/appexemplo_v2.0/api/api_controllers/Acesso_perfil_menuAPI.class.php b/appexemplo_v2.0/api/api_controllers/Acesso_perfil_menuAPI.class.php index 3cf7553c..24c60abe 100644 --- a/appexemplo_v2.0/api/api_controllers/Acesso_perfil_menuAPI.class.php +++ b/appexemplo_v2.0/api/api_controllers/Acesso_perfil_menuAPI.class.php @@ -63,13 +63,16 @@ public static function save(Request $request, Response $response, array $args) { $vo = new \Acesso_perfil_menuVO; $msg = \Message::GENERIC_INSERT; - if($request->isPut()){ + if($request->getMethod() == 'PUT'){ $msg = \Message::GENERIC_UPDATE; $result = self::selectByIdInside($args); $bodyRequest = $result[0]; $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); } $bodyRequest = json_decode($request->getBody(),true); + if(empty($bodyRequest)){ + $bodyRequest = $request->getParsedBody(); + } $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); $controller = new \Acesso_perfil_menu; diff --git a/appexemplo_v2.0/api/api_controllers/Acesso_perfil_userAPI.class.php b/appexemplo_v2.0/api/api_controllers/Acesso_perfil_userAPI.class.php index bde76ffe..9c3b485a 100644 --- a/appexemplo_v2.0/api/api_controllers/Acesso_perfil_userAPI.class.php +++ b/appexemplo_v2.0/api/api_controllers/Acesso_perfil_userAPI.class.php @@ -63,13 +63,16 @@ public static function save(Request $request, Response $response, array $args) { $vo = new \Acesso_perfil_userVO; $msg = \Message::GENERIC_INSERT; - if($request->isPut()){ + if($request->getMethod() == 'PUT'){ $msg = \Message::GENERIC_UPDATE; $result = self::selectByIdInside($args); $bodyRequest = $result[0]; $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); } $bodyRequest = json_decode($request->getBody(),true); + if(empty($bodyRequest)){ + $bodyRequest = $request->getParsedBody(); + } $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); $controller = new \Acesso_perfil_user; diff --git a/appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php b/appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php index 14ae408f..556d8cbf 100644 --- a/appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php +++ b/appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php @@ -63,13 +63,16 @@ public static function save(Request $request, Response $response, array $args) { $vo = new \Acesso_userVO; $msg = \Message::GENERIC_INSERT; - if($request->isPut()){ + if($request->getMethod() == 'PUT'){ $msg = \Message::GENERIC_UPDATE; $result = self::selectByIdInside($args); $bodyRequest = $result[0]; $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); } $bodyRequest = json_decode($request->getBody(),true); + if(empty($bodyRequest)){ + $bodyRequest = $request->getParsedBody(); + } $vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); $controller = new \Acesso_user;