Skip to content

Commit

Permalink
🔨 #270 update controller e api
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 28, 2022
1 parent 9ac2158 commit 5845146
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
13 changes: 9 additions & 4 deletions appexemplo_v2.0/api/api_controllers/MarcaAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.11.0
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2022-09-27 15:40:17
* System appev2 created in: 2022-09-28 00:42:12
*/

namespace api_controllers;
Expand Down Expand Up @@ -38,7 +38,9 @@ public static function selectAll(Request $request, Response $response, array $ar
$result = \ArrayHelper::convertArrayFormDin2Pdo($result);
$msg = array( 'qtd_total'=> $qtd_total
, 'qtd_result'=> \CountHelper::count($result)
, 'result'=>$result
, 'page'=>$page
, 'pages'=>$page
, 'result'=>round($qtd_total/$rowsPerPage)
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
Expand Down Expand Up @@ -85,7 +87,10 @@ public static function save(Request $request, Response $response, array $args)
if($request->getMethod() == 'PUT'){
$msg = \Message::GENERIC_UPDATE;
$result = self::selectByIdInside($args);
$bodyRequest = $result[0];
$bodyRequest = \ArrayHelper::get($result,0);
if( empty($bodyRequest) ){
throw new \DomainException(\Message::GENERIC_ID_NOT_EXIST);
}
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
}
$bodyRequest = json_decode($request->getBody(),true);
Expand Down
13 changes: 9 additions & 4 deletions appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.11.0
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2022-09-27 15:40:17
* System appev2 created in: 2022-09-28 00:42:12
*/

namespace api_controllers;
Expand Down Expand Up @@ -38,7 +38,9 @@ public static function selectAll(Request $request, Response $response, array $ar
$result = \ArrayHelper::convertArrayFormDin2Pdo($result);
$msg = array( 'qtd_total'=> $qtd_total
, 'qtd_result'=> \CountHelper::count($result)
, 'result'=>$result
, 'page'=>$page
, 'pages'=>$page
, 'result'=>round($qtd_total/$rowsPerPage)
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
Expand Down Expand Up @@ -85,7 +87,10 @@ public static function save(Request $request, Response $response, array $args)
if($request->getMethod() == 'PUT'){
$msg = \Message::GENERIC_UPDATE;
$result = self::selectByIdInside($args);
$bodyRequest = $result[0];
$bodyRequest = \ArrayHelper::get($result,0);
if( empty($bodyRequest) ){
throw new \DomainException(\Message::GENERIC_ID_NOT_EXIST);
}
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
}
$bodyRequest = json_decode($request->getBody(),true);
Expand Down
13 changes: 9 additions & 4 deletions appexemplo_v2.0/api/api_controllers/MunicipioAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.11.0
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2022-09-27 15:40:17
* System appev2 created in: 2022-09-28 00:42:12
*/

namespace api_controllers;
Expand Down Expand Up @@ -38,7 +38,9 @@ public static function selectAll(Request $request, Response $response, array $ar
$result = \ArrayHelper::convertArrayFormDin2Pdo($result);
$msg = array( 'qtd_total'=> $qtd_total
, 'qtd_result'=> \CountHelper::count($result)
, 'result'=>$result
, 'page'=>$page
, 'pages'=>$page
, 'result'=>round($qtd_total/$rowsPerPage)
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
Expand Down Expand Up @@ -85,7 +87,10 @@ public static function save(Request $request, Response $response, array $args)
if($request->getMethod() == 'PUT'){
$msg = \Message::GENERIC_UPDATE;
$result = self::selectByIdInside($args);
$bodyRequest = $result[0];
$bodyRequest = \ArrayHelper::get($result,0);
if( empty($bodyRequest) ){
throw new \DomainException(\Message::GENERIC_ID_NOT_EXIST);
}
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
}
$bodyRequest = json_decode($request->getBody(),true);
Expand Down

0 comments on commit 5845146

Please sign in to comment.