Skip to content

Commit

Permalink
🔨 #118 alterando a resposta
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Jul 30, 2022
1 parent ef00f7f commit 3349794
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions controllers/CreateApiControllesFiles.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public function addConstruct()
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
public function addBodyJsonResponse()
{
$this->addBlankLine();
$this->addLine(ESP.ESP.'$response = TGenericAPI::getBodyJson($msg,$response);');
$this->addLine(ESP.ESP.'return $response;');
}
//--------------------------------------------------------------------------------------
public function addSelectAll()
{
$this->addBlankLine();
Expand All @@ -95,8 +102,7 @@ public function addSelectAll()
$this->addLine(ESP.ESP.'$msg = array( \'qtd\'=> \CountHelper::count($result)');
$this->addLine(ESP.ESP.ESP.ESP.ESP.', \'result\'=>$result');
$this->addLine(ESP.ESP.');');
$this->addLine(ESP.ESP.'$response = $response->withJson($msg);');
$this->addLine(ESP.ESP.'return $response;');
$this->addBodyJsonResponse();
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
Expand Down Expand Up @@ -124,8 +130,7 @@ public function addSelectById()
$this->addLine(ESP.ESP.'$msg = array( \'qtd\'=> \CountHelper::count($result)');
$this->addLine(ESP.ESP.ESP.ESP.ESP.', \'result\'=>$result');
$this->addLine(ESP.ESP.');');
$this->addLine(ESP.ESP.'$response = $response->withJson($msg);');
$this->addLine(ESP.ESP.'return $response;');
$this->addBodyJsonResponse();
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
Expand Down Expand Up @@ -165,8 +170,7 @@ public function addSave()
$this->addLine(ESP.ESP.'$controller = new \\'.ucfirst( $this->getTableName() ).';');
$this->addLine(ESP.ESP.'$controller->save($vo);');
$this->addBlankLine();
$this->addLine(ESP.ESP.'$response = $response->withJson($msg);');
$this->addLine(ESP.ESP.'return $response;');
$this->addBodyJsonResponse();
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
Expand All @@ -179,8 +183,7 @@ public function addDelete()
$this->addLine(ESP.ESP.'$id = $args[\'id\'];');
$this->addLine(ESP.ESP.'$controller = new \\'.ucfirst( $this->getTableName() ).';');
$this->addLine(ESP.ESP.'$msg = $controller->delete($id);');
$this->addLine(ESP.ESP.'$response = $response->withJson($msg);');
$this->addLine(ESP.ESP.'return $response;');
$this->addBodyJsonResponse();
$this->addLine(ESP.'}');
}
//--------------------------------------------------------------------------------------
Expand Down

0 comments on commit 3349794

Please sign in to comment.