Skip to content

Commit

Permalink
🔨 #118 SelectAll
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent 9bf2dd1 commit eb45e9d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions controllers/CreateApiControllesFiles.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,22 @@ public function addSelectAll()
$this->addLine();
$this->addLine(ESP.'public static function selectAll(Request $request, Response $response, array $args)');
$this->addLine(ESP.'{');
$this->addLine(ESP.ESP.'$param = $request->getQueryParams();');
$this->addLine(ESP.ESP.'$page = TGenericAPI::getSelectNumPage($param);');
$this->addLine(ESP.ESP.'$rowsPerPage = TGenericAPI::getSelectNumRowsPerPage($param);');
$this->addLine(ESP.ESP.'$orderBy = null;');
$this->addLine(ESP.ESP.'$where = array();');
$this->addLine(ESP.ESP.'try{');
$this->addLine(ESP.ESP.ESP.'$param = $request->getQueryParams();');
$this->addLine(ESP.ESP.ESP.'$page = TGenericAPI::getSelectNumPage($param);');
$this->addLine(ESP.ESP.ESP.'$rowsPerPage = TGenericAPI::getSelectNumRowsPerPage($param);');
$this->addLine(ESP.ESP.ESP.'$orderBy = null;');
$this->addLine(ESP.ESP.ESP.'$where = array();');
$this->addLine();
$this->addLine(ESP.ESP.'$controller = new \\'.ucfirst( $this->getTableName() ).'();');
$this->addLine(ESP.ESP.'//$result = $controller->selectAll();');
$this->addLine(ESP.ESP.'$result = $controller->selectAllPagination( $orderBy, $where, $page, $rowsPerPage);');
$this->addLine(ESP.ESP.'$result = \ArrayHelper::convertArrayFormDin2Pdo($result);');
$this->addLine(ESP.ESP.'$msg = array( \'qtd\'=> \CountHelper::count($result)');
$this->addLine(ESP.ESP.ESP.ESP.ESP.', \'result\'=>$result');
$this->addLine(ESP.ESP.');');
$this->addBodyJsonResponse();
$this->addLine(ESP.ESP.ESP.'$controller = new \\'.ucfirst( $this->getTableName() ).'();');
$this->addLine(ESP.ESP.ESP.'//$result = $controller->selectAll();');
$this->addLine(ESP.ESP.ESP.'$result = $controller->selectAllPagination( $orderBy, $where, $page, $rowsPerPage);');
$this->addLine(ESP.ESP.ESP.'$result = \ArrayHelper::convertArrayFormDin2Pdo($result);');
$this->addLine(ESP.ESP.ESP.'$msg = array( \'qtd\'=> \CountHelper::count($result)');
$this->addLine(ESP.ESP.ESP.ESP.ESP.ESP.', \'result\'=>$result');
$this->addLine(ESP.ESP.ESP.');');
$this->addBodyJsonResponse(ESP.ESP.ESP,200);
$this->addCatchBodyJsonResponse(ESP.ESP,500);
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
Expand Down

0 comments on commit eb45e9d

Please sign in to comment.