Skip to content

Commit

Permalink
🔨 APP #270 update DAO
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 28, 2022
1 parent b5fe925 commit ec77131
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 501 deletions.
470 changes: 229 additions & 241 deletions appexemplo_v2.5/dao/Acesso_menuDAO.class.php

Large diffs are not rendered by default.

34 changes: 11 additions & 23 deletions appexemplo_v2.5/dao/Acesso_perfilDAO.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.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.10.1-alpha
* FormDin Version: 4.7.9-alpha
*
* System appev2 created in: 2019-09-10 11:31:30
* System appev2 created in: 2019-11-01 22:23:14
*/
class Acesso_perfilDAO
{
Expand All @@ -24,7 +24,7 @@ class Acesso_perfilDAO

public function __construct($tpdo=null)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
if( empty($tpdo) ){
$tpdo = New TPDOConnectionObj();
}
Expand All @@ -36,16 +36,9 @@ public function getTPDOConnection()
}
public function setTPDOConnection($tpdo)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
$this->tpdo = $tpdo;
}
public function validateObjType($tpdo)
{
$typeObjWrong = !($tpdo instanceof TPDOConnectionObj);
if( !is_null($tpdo) && $typeObjWrong ){
throw new InvalidArgumentException('class:'.__METHOD__);
}
}
private function processWhereGridParameters( $whereGrid )
{
$result = $whereGrid;
Expand All @@ -63,9 +56,7 @@ private function processWhereGridParameters( $whereGrid )
//--------------------------------------------------------------------------------
public function selectById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = self::$sqlBasicSelect.' where idperfil = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand Down Expand Up @@ -120,7 +111,8 @@ public function insert( Acesso_perfilVO $objVo )
,dat_update
) values (?,?,?,?)';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
$result = $this->tpdo->getLastInsertId();
return intval($result);
}
//--------------------------------------------------------------------------------
public function update ( Acesso_perfilVO $objVo )
Expand All @@ -137,14 +129,12 @@ public function update ( Acesso_perfilVO $objVo )
,dat_update = ?
where idperfil = ?';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
return intval($result);
}
//--------------------------------------------------------------------------------
public function delete( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = 'delete from form_exemplo.acesso_perfil where idperfil = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand All @@ -153,9 +143,7 @@ public function delete( $id )
//--------------------------------------------------------------------------------
public function getVoById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$result = $this->selectById( $id );
$result = \ArrayHelper::convertArrayFormDin2Pdo($result,false);
$result = $result[0];
Expand Down
38 changes: 13 additions & 25 deletions appexemplo_v2.5/dao/Acesso_perfil_menuDAO.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.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.10.1-alpha
* FormDin Version: 4.7.9-alpha
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2019-11-01 22:23:14
*/
class Acesso_perfil_menuDAO
{
Expand All @@ -25,9 +25,9 @@ class Acesso_perfil_menuDAO

private $tpdo = null;

public function __construct($tpdo=null) {

$this->validateObjType($tpdo);
public function __construct($tpdo=null)
{
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
if( empty($tpdo) ){
$tpdo = New TPDOConnectionObj();
}
Expand All @@ -39,16 +39,9 @@ public function getTPDOConnection()
}
public function setTPDOConnection($tpdo)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
$this->tpdo = $tpdo;
}
public function validateObjType($tpdo)
{
$typeObjWrong = !($tpdo instanceof TPDOConnectionObj);
if( !is_null($tpdo) && $typeObjWrong ){
throw new InvalidArgumentException('class:'.__METHOD__);
}
}
private function processWhereGridParameters( $whereGrid )
{
$result = $whereGrid;
Expand All @@ -67,9 +60,7 @@ private function processWhereGridParameters( $whereGrid )
//--------------------------------------------------------------------------------
public function selectById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = self::$sqlBasicSelect.' where idperfilmenu = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand Down Expand Up @@ -126,7 +117,8 @@ public function insert( Acesso_perfil_menuVO $objVo )
,dat_update
) values (?,?,?,?,?)';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
$result = $this->tpdo->getLastInsertId();
return intval($result);
}
//--------------------------------------------------------------------------------
public function update ( Acesso_perfil_menuVO $objVo )
Expand All @@ -145,14 +137,12 @@ public function update ( Acesso_perfil_menuVO $objVo )
,dat_update = ?
where idperfilmenu = ?';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
return intval($result);
}
//--------------------------------------------------------------------------------
public function delete( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = 'delete from form_exemplo.acesso_perfil_menu where idperfilmenu = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand All @@ -161,9 +151,7 @@ public function delete( $id )
//--------------------------------------------------------------------------------
public function getVoById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$result = $this->selectById( $id );
$result = \ArrayHelper::convertArrayFormDin2Pdo($result,false);
$result = $result[0];
Expand Down
41 changes: 14 additions & 27 deletions appexemplo_v2.5/dao/Acesso_perfil_userDAO.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.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.10.1-alpha
* FormDin Version: 4.7.9-alpha
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2019-11-01 22:23:14
*/
class Acesso_perfil_userDAO
{
Expand All @@ -25,8 +25,9 @@ class Acesso_perfil_userDAO

private $tpdo = null;

public function __construct($tpdo=null) {
$this->validateObjType($tpdo);
public function __construct($tpdo=null)
{
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
if( empty($tpdo) ){
$tpdo = New TPDOConnectionObj();
}
Expand All @@ -38,16 +39,9 @@ public function getTPDOConnection()
}
public function setTPDOConnection($tpdo)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
$this->tpdo = $tpdo;
}
public function validateObjType($tpdo)
{
$typeObjWrong = !($tpdo instanceof TPDOConnectionObj);
if( !is_null($tpdo) && $typeObjWrong ){
throw new InvalidArgumentException('class:'.__METHOD__);
}
}
private function processWhereGridParameters( $whereGrid )
{
$result = $whereGrid;
Expand All @@ -66,9 +60,7 @@ private function processWhereGridParameters( $whereGrid )
//--------------------------------------------------------------------------------
public function selectById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = self::$sqlBasicSelect.' where idperfiluser = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand Down Expand Up @@ -125,7 +117,8 @@ public function insert( Acesso_perfil_userVO $objVo )
,dat_update
) values (?,?,?,?,?)';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
$result = $this->tpdo->getLastInsertId();
return intval($result);
}
//--------------------------------------------------------------------------------
public function update ( Acesso_perfil_userVO $objVo )
Expand All @@ -144,14 +137,12 @@ public function update ( Acesso_perfil_userVO $objVo )
,dat_update = ?
where idperfiluser = ?';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
return intval($result);
}
//--------------------------------------------------------------------------------
public function delete( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = 'delete from form_exemplo.acesso_perfil_user where idperfiluser = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand All @@ -160,9 +151,7 @@ public function delete( $id )
//--------------------------------------------------------------------------------
public function deleteByIdUser( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = 'delete from form_exemplo.acesso_perfil_user where iduser = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand All @@ -171,9 +160,7 @@ public function deleteByIdUser( $id )
//--------------------------------------------------------------------------------
public function getVoById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$result = $this->selectById( $id );
$result = \ArrayHelper::convertArrayFormDin2Pdo($result,false);
$result = $result[0];
Expand Down
34 changes: 11 additions & 23 deletions appexemplo_v2.5/dao/Acesso_userDAO.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.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.10.1-alpha
* FormDin Version: 4.7.9-alpha
*
* System appev2 created in: 2019-09-10 11:31:30
* System appev2 created in: 2019-11-01 22:23:15
*/
class Acesso_userDAO
{
Expand All @@ -26,7 +26,7 @@ class Acesso_userDAO

public function __construct($tpdo=null)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
if( empty($tpdo) ){
$tpdo = New TPDOConnectionObj();
}
Expand All @@ -38,16 +38,9 @@ public function getTPDOConnection()
}
public function setTPDOConnection($tpdo)
{
$this->validateObjType($tpdo);
FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__);
$this->tpdo = $tpdo;
}
public function validateObjType($tpdo)
{
$typeObjWrong = !($tpdo instanceof TPDOConnectionObj);
if( !is_null($tpdo) && $typeObjWrong ){
throw new InvalidArgumentException('class:'.__METHOD__);
}
}
private function processWhereGridParameters( $whereGrid )
{
$result = $whereGrid;
Expand All @@ -67,9 +60,7 @@ private function processWhereGridParameters( $whereGrid )
//--------------------------------------------------------------------------------
public function selectById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = self::$sqlBasicSelect.' where iduser = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand Down Expand Up @@ -135,7 +126,8 @@ public function insert( Acesso_userVO $objVo )
,idpessoa
) values (?,?,?,?)';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
$result = $this->tpdo->getLastInsertId();
return intval($result);
}
//--------------------------------------------------------------------------------
public function update ( Acesso_userVO $objVo )
Expand All @@ -152,7 +144,7 @@ public function update ( Acesso_userVO $objVo )
,idpessoa = ?
where iduser = ?';
$result = $this->tpdo->executeSql($sql, $values);
return $result;
return intval($result);
}
//--------------------------------------------------------------------------------
public function updateSenha ( Acesso_userVO $objVo )
Expand All @@ -169,9 +161,7 @@ public function updateSenha ( Acesso_userVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$values = array($id);
$sql = 'delete from form_exemplo.acesso_user where iduser = ?';
$result = $this->tpdo->executeSql($sql, $values);
Expand All @@ -180,9 +170,7 @@ public function delete( $id )
//--------------------------------------------------------------------------------
public function getVoById( $id )
{
if( empty($id) || !is_numeric($id) ){
throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__);
}
FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__);
$result = $this->selectById( $id );
$result = \ArrayHelper::convertArrayFormDin2Pdo($result,false);
$result = $result[0];
Expand Down
Loading

0 comments on commit ec77131

Please sign in to comment.