Skip to content

Commit

Permalink
📝 APP #270 correção metodo PUT
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 24, 2022
1 parent d28376c commit 9789ff8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion appexemplo_v2.0/api/api_controllers/Acesso_menuAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion appexemplo_v2.0/api/api_controllers/Acesso_userAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9789ff8

Please sign in to comment.