From a18e7b9c5ce55376121a5b879ba7d900cbabce79 Mon Sep 17 00:00:00 2001 From: Bjverde Date: Mon, 9 Mar 2020 23:48:35 -0300 Subject: [PATCH] :memo: APP #220 primeiro cliente --- appexemplo_v3.0/controllers/Regiao.class.php | 7 +++++-- appexemplo_v3.0/modulos/regiao.php | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/appexemplo_v3.0/controllers/Regiao.class.php b/appexemplo_v3.0/controllers/Regiao.class.php index c93730ab..21d3843d 100644 --- a/appexemplo_v3.0/controllers/Regiao.class.php +++ b/appexemplo_v3.0/controllers/Regiao.class.php @@ -14,10 +14,11 @@ class Regiao private $dao = null; + private $client = null; public function __construct($tpdo = null) { - $this->dao = new RegiaoDAO($tpdo); + $this->client = new GuzzleHttp\Client(['base_uri' => 'http://localhost/formDin/appexemplo_v2.0/api/']); } public function getDao() { @@ -48,7 +49,9 @@ public function selectAllPagination( $orderBy=null, $where=null, $page=null, $r //-------------------------------------------------------------------------------- public function selectAll( $orderBy=null, $where=null ) { - $result = $this->dao->selectAll( $orderBy, $where ); + $response = $this->client->request('GET', 'regiao'); + $contents = $response->getBody()->getContents(); + $result = json_decode($contents); return $result; } //-------------------------------------------------------------------------------- diff --git a/appexemplo_v3.0/modulos/regiao.php b/appexemplo_v3.0/modulos/regiao.php index 9a266055..0c03a4d0 100644 --- a/appexemplo_v3.0/modulos/regiao.php +++ b/appexemplo_v3.0/modulos/regiao.php @@ -13,6 +13,10 @@ defined('APLICATIVO') or die(); require_once 'modulos/includes/acesso_view_allowed.php'; +$controller = new Regiao(); +$result = $controller->selectAll(); +var_dump($result); + $primaryKey = 'COD_REGIAO'; $frm = new TForm('Cadastro de RegiƵes',800,950); $frm->setShowCloseButton(false);