-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add HistoricoClientes entidade
- Loading branch information
1 parent
f5b709f
commit 194c679
Showing
6 changed files
with
182 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* CRUDAbstractCtrl.class [ ABSTRACT ] | ||
* Responsavel por Padronizar o CRUD do sistema para cada Controller | ||
* @copyright (c) 2018 | ||
* @author Armando JR. ELFISERVICE | ||
*/ | ||
abstract class CRUDAbstractCtrl { | ||
//put your code here | ||
|
||
/** | ||
* Fazer INSERT no BD na tabela = logs | ||
* @param Log $obj = passar uma Instancia deste tipo para inserir no BD | ||
* @return boolean = TRUE se Sucesso ao inserir dados no BD e FALSE se houver algum problema na INSERÇÃO ou se o OBJETO não foi passado corretamente | ||
*/ | ||
public function inserirBD($obj, $dao) { | ||
$nomeDaClasse = get_class($obj); | ||
if ($obj instanceof $nomeDaClasse) { | ||
|
||
foreach ((array) $obj as $campo => $valor) { | ||
$campo = str_replace("\0{$nomeDaClasse}\0", "", $campo); | ||
$campoArr[$campo] = $campo; | ||
} | ||
// var_dump($campoArr); | ||
//unset($campoArr['id']); | ||
$arrObj = array_values((array) $obj); | ||
|
||
//unset($arrObj[0]); | ||
|
||
$campoArr = implode(', ', array_keys($campoArr)); | ||
$valores = " '" . implode("','", array_values($arrObj)) . "' "; | ||
//var_dump($campoArr,$valores); | ||
//$logDao = new LogDAO(); | ||
|
||
if ($dao->insert($campoArr, $valores)) { | ||
return TRUE; | ||
} else { | ||
return FALSE; | ||
} | ||
} else { | ||
return FALSE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
/** | ||
* Description of HistoricoClientes | ||
* | ||
* @author armandojunior | ||
*/ | ||
class HistoricoClientes extends CRUDAbstractCtrl { | ||
|
||
private $clienteDao; | ||
|
||
public function HistoricoClientes() { | ||
$this->clienteDao = new HistoricoClientesDAO(); | ||
} | ||
|
||
public function inserirBD($obj) { | ||
return parent::inserirBD($obj, $this->clienteDao); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* CRUDAbstract.class [ ABSTRACT ] | ||
* Responsavel por Padronizar o CRUD do sistema para cada Entidade | ||
* @copyright (c) 2018, Armando JR. ELFISERVICE | ||
*/ | ||
abstract class CRUDAbstract { | ||
|
||
|
||
public function delete($termos, $tabela = self::Tabela) { | ||
|
||
} | ||
|
||
public function insert($camposBd, $valores, $tabela = self::Tabela) { | ||
$insert = new Insert(); | ||
$insert->ExecInsert($tabela, $camposBd, $valores); | ||
return $insert->getResultado(); | ||
} | ||
|
||
public function select($campos, $termos, $tabela = self::Tabela) { | ||
$read = new Read(); | ||
$read->ExecRead($campos, $tabela, $termos); | ||
return $read->getResultado(); | ||
} | ||
|
||
public function update($camposDados, $termos, $tabela = self::Tabela) { | ||
$update = new Update(); | ||
$update->ExecUpdate($tabela, $camposDados, $termos); | ||
return $update->getResultado(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* HistoricoClientesDAO.class [ DAO ] | ||
* Responsavel gerencia a PErsistencia para Tabela historico_clientes | ||
* @copyright (c) 2018, Armando JR. ELFISERVICE | ||
*/ | ||
class HistoricoClientesDAO extends CRUDAbstract { | ||
|
||
const Tabela = 'historico_clientes'; | ||
|
||
public function insert($camposBd, $valores, $tabela = self::Tabela) { | ||
return parent::insert($camposBd, $valores, $tabela); | ||
} | ||
|
||
public function select($campos, $termos, $tabela = self::Tabela) { | ||
return parent::select($campos, $termos, $tabela); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
echo 'aqui'; | ||
|
||
/** | ||
* HistoricoClientes.class [ MODEL ] | ||
* Modelar dados da Tablea historico_clientes | ||
* @copyright (c) 2018, Armando JR. ELFISERVICE | ||
*/ | ||
class HistoricoClientes { | ||
private $id; | ||
private $id_cliente; | ||
private $alteracao; | ||
private $data; | ||
|
||
public function __construct($id, $id_cliente, $alteracao, $data) { | ||
$this->id = $id; | ||
$this->id_cliente = $id_cliente; | ||
$this->alteracao = $alteracao; | ||
$this->data = $data; | ||
} | ||
|
||
public function getId() { | ||
return $this->id; | ||
} | ||
|
||
public function getId_cliente() { | ||
return $this->id_cliente; | ||
} | ||
|
||
public function getAlteracao() { | ||
return $this->alteracao; | ||
} | ||
|
||
public function getData() { | ||
return $this->data; | ||
} | ||
|
||
public function setId($id) { | ||
$this->id = $id; | ||
} | ||
|
||
public function setId_cliente($id_cliente) { | ||
$this->id_cliente = $id_cliente; | ||
} | ||
|
||
public function setAlteracao($alteracao) { | ||
$this->alteracao = $alteracao; | ||
} | ||
|
||
public function setData($data) { | ||
$this->data = $data; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters