diff --git a/appexemplo_v2.5/dao/Acesso_menuDAO.class.php b/appexemplo_v2.5/dao/Acesso_menuDAO.class.php index b1989134..936f3ef9 100644 --- a/appexemplo_v2.5/dao/Acesso_menuDAO.class.php +++ b/appexemplo_v2.5/dao/Acesso_menuDAO.class.php @@ -1,242 +1,230 @@ -validateObjType($tpdo); - if( empty($tpdo) ){ - $tpdo = New TPDOConnectionObj(); - } - $this->setTPDOConnection($tpdo); - } - public function getTPDOConnection() - { - return $this->tpdo; - } - public function setTPDOConnection($tpdo) - { - $this->validateObjType($tpdo); - $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; - if ( is_array($whereGrid) ){ - $where = ' 1=1 '; - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IDMENU', SqlHelper::SQL_TYPE_NUMERIC); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'NOM_MENU', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IDMENU_PAI', SqlHelper::SQL_TYPE_NUMERIC); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'URL', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'TOOLTIP', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IMG_MENU', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IMGDISABLED', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DISABLED', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'HOTKEY', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'BOOLSEPARATOR', SqlHelper::SQL_TYPE_NUMERIC); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'JSONPARAMS', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'SIT_ATIVO', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DAT_INCLUSAO', SqlHelper::SQL_TYPE_TEXT_LIKE); - $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DAT_UPDATE', SqlHelper::SQL_TYPE_TEXT_LIKE); - $result = $where; - } - return $result; - } - //-------------------------------------------------------------------------------- - public function selectById( $id ) - { - if( empty($id) || !is_numeric($id) ){ - throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__); - } - $values = array($id); - $sql = self::$sqlBasicSelect.' where idmenu = ?'; - $result = $this->tpdo->executeSql($sql, $values); - return $result; - } - //-------------------------------------------------------------------------------- - public function selectCount( $where=null ) - { - $where = $this->processWhereGridParameters($where); - $sql = 'select count(idmenu) as qtd from form_exemplo.acesso_menu'; - $sql = $sql.( ($where)? ' where '.$where:''); - $result = $this->tpdo->executeSql($sql); - return $result['QTD'][0]; - } - //-------------------------------------------------------------------------------- - public function selectAllPagination( $orderBy=null, $where=null, $page=null, $rowsPerPage= null ) - { - $rowStart = SqlHelper::getRowStart($page,$rowsPerPage); - $where = $this->processWhereGridParameters($where); - - $sql = self::$sqlBasicSelect - .( ($where)? ' where '.$where:'') - .( ($orderBy) ? ' order by '.$orderBy:'') - .( ' LIMIT '.$rowStart.','.$rowsPerPage); - - $result = $this->tpdo->executeSql($sql); - return $result; - } - //-------------------------------------------------------------------------------- - public function selectAll( $orderBy=null, $where=null ) - { - $where = $this->processWhereGridParameters($where); - $sql = self::$sqlBasicSelect - .( ($where)? ' where '.$where:'') - .( ($orderBy) ? ' order by '.$orderBy:''); - - $result = $this->tpdo->executeSql($sql); - return $result; - } - //-------------------------------------------------------------------------------- - public function selectMenuByLogin( $login_user ) - { - $values = array($login_user); - $sql = 'select - m.idmenu - ,m.idmenu_pai - ,m.nom_menu - ,m.url - ,m.tooltip - ,m.img_menu - ,m.imgdisabled - ,m.disabled - ,m.hotkey - ,m.boolseparator - ,m.jsonparams - ,m.sit_ativo - ,m.dat_inclusao - ,m.dat_update - from acesso_menu as m - ,vw_acesso_user_menu as um - where um.idmenu = m.idmenu - AND um.login_user = ?'; - $result = $this->tpdo->executeSql($sql, $values); - return $result; - } - //-------------------------------------------------------------------------------- - public function insert( Acesso_menuVO $objVo ) - { - $values = array( $objVo->getNom_menu() - , $objVo->getIdmenu_pai() - , $objVo->getUrl() - , $objVo->getTooltip() - , $objVo->getImg_menu() - , $objVo->getImgdisabled() - , $objVo->getDisabled() - , $objVo->getHotkey() - , $objVo->getBoolseparator() - , $objVo->getJsonparams() - , $objVo->getSit_ativo() - , $objVo->getDat_inclusao() - ); - $sql = 'insert into form_exemplo.acesso_menu( - nom_menu - ,idmenu_pai - ,url - ,tooltip - ,img_menu - ,imgdisabled - ,disabled - ,hotkey - ,boolseparator - ,jsonparams - ,sit_ativo - ,dat_inclusao - ,dat_update - ) values (?,?,?,?,?,?,?,?,?,?,?,?)'; - $result = $this->tpdo->executeSql($sql, $values); - return $result; - } - //-------------------------------------------------------------------------------- - public function update ( Acesso_menuVO $objVo ) - { - $values = array( $objVo->getNom_menu() - ,$objVo->getIdmenu_pai() - ,$objVo->getUrl() - ,$objVo->getTooltip() - ,$objVo->getImg_menu() - ,$objVo->getImgdisabled() - ,$objVo->getDisabled() - ,$objVo->getHotkey() - ,$objVo->getBoolseparator() - ,$objVo->getJsonparams() - ,$objVo->getSit_ativo() - ,$objVo->getIdmenu() ); - $sql = 'update form_exemplo.acesso_menu set - nom_menu = ? - ,idmenu_pai = ? - ,url = ? - ,tooltip = ? - ,img_menu = ? - ,imgdisabled = ? - ,disabled = ? - ,hotkey = ? - ,boolseparator = ? - ,jsonparams = ? - ,sit_ativo = ? - where idmenu = ?'; - $result = $this->tpdo->executeSql($sql, $values); - return $result; - } - //-------------------------------------------------------------------------------- - public function delete( $id ) - { - if( empty($id) || !is_numeric($id) ){ - throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__); - } - $values = array($id); - $sql = 'delete from form_exemplo.acesso_menu where idmenu = ?'; - $result = $this->tpdo->executeSql($sql, $values); - return $result; - } - //-------------------------------------------------------------------------------- - public function getVoById( $id ) - { - if( empty($id) || !is_numeric($id) ){ - throw new InvalidArgumentException(Message::TYPE_NOT_INT.'class:'.__METHOD__); - } - $result = $this->selectById( $id ); - $result = \ArrayHelper::convertArrayFormDin2Pdo($result,false); - $result = $result[0]; - $vo = new Acesso_menuVO(); - $vo = \FormDinHelper::setPropertyVo($result,$vo); - return $vo; - } -} +setTPDOConnection($tpdo); + } + public function getTPDOConnection() + { + return $this->tpdo; + } + public function setTPDOConnection($tpdo) + { + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); + $this->tpdo = $tpdo; + } + private function processWhereGridParameters( $whereGrid ) + { + $result = $whereGrid; + if ( is_array($whereGrid) ){ + $where = ' 1=1 '; + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IDMENU', SqlHelper::SQL_TYPE_NUMERIC); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'NOM_MENU', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IDMENU_PAI', SqlHelper::SQL_TYPE_NUMERIC); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'URL', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'TOOLTIP', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IMG_MENU', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'IMGDISABLED', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DISABLED', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'HOTKEY', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'BOOLSEPARATOR', SqlHelper::SQL_TYPE_NUMERIC); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'JSONPARAMS', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'SIT_ATIVO', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DAT_INCLUSAO', SqlHelper::SQL_TYPE_TEXT_LIKE); + $where = SqlHelper::getAtributeWhereGridParameters($where, $whereGrid, 'DAT_UPDATE', SqlHelper::SQL_TYPE_TEXT_LIKE); + $result = $where; + } + return $result; + } + //-------------------------------------------------------------------------------- + public function selectById( $id ) + { + FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__); + $values = array($id); + $sql = self::$sqlBasicSelect.' where idmenu = ?'; + $result = $this->tpdo->executeSql($sql, $values); + return $result; + } + //-------------------------------------------------------------------------------- + public function selectCount( $where=null ) + { + $where = $this->processWhereGridParameters($where); + $sql = 'select count(idmenu) as qtd from form_exemplo.acesso_menu'; + $sql = $sql.( ($where)? ' where '.$where:''); + $result = $this->tpdo->executeSql($sql); + return $result['QTD'][0]; + } + //-------------------------------------------------------------------------------- + public function selectAllPagination( $orderBy=null, $where=null, $page=null, $rowsPerPage= null ) + { + $rowStart = SqlHelper::getRowStart($page,$rowsPerPage); + $where = $this->processWhereGridParameters($where); + + $sql = self::$sqlBasicSelect + .( ($where)? ' where '.$where:'') + .( ($orderBy) ? ' order by '.$orderBy:'') + .( ' LIMIT '.$rowStart.','.$rowsPerPage); + + $result = $this->tpdo->executeSql($sql); + return $result; + } + //-------------------------------------------------------------------------------- + public function selectAll( $orderBy=null, $where=null ) + { + $where = $this->processWhereGridParameters($where); + $sql = self::$sqlBasicSelect + .( ($where)? ' where '.$where:'') + .( ($orderBy) ? ' order by '.$orderBy:''); + + $result = $this->tpdo->executeSql($sql); + return $result; + } + //-------------------------------------------------------------------------------- + public function selectMenuByLogin( $login_user ) + { + $values = array($login_user); + $sql = 'select + m.idmenu + ,m.idmenu_pai + ,m.nom_menu + ,m.url + ,m.tooltip + ,m.img_menu + ,m.imgdisabled + ,m.disabled + ,m.hotkey + ,m.boolseparator + ,m.jsonparams + ,m.sit_ativo + ,m.dat_inclusao + ,m.dat_update + from acesso_menu as m + ,vw_acesso_user_menu as um + where um.idmenu = m.idmenu + AND um.login_user = ?'; + $result = $this->tpdo->executeSql($sql, $values); + return $result; + } + //-------------------------------------------------------------------------------- + public function insert( Acesso_menuVO $objVo ) + { + $values = array( $objVo->getNom_menu() + , $objVo->getIdmenu_pai() + , $objVo->getUrl() + , $objVo->getTooltip() + , $objVo->getImg_menu() + , $objVo->getImgdisabled() + , $objVo->getDisabled() + , $objVo->getHotkey() + , $objVo->getBoolseparator() + , $objVo->getJsonparams() + , $objVo->getSit_ativo() + , $objVo->getDat_inclusao() + ); + $sql = 'insert into form_exemplo.acesso_menu( + nom_menu + ,idmenu_pai + ,url + ,tooltip + ,img_menu + ,imgdisabled + ,disabled + ,hotkey + ,boolseparator + ,jsonparams + ,sit_ativo + ,dat_inclusao + ,dat_update + ) values (?,?,?,?,?,?,?,?,?,?,?,?)'; + $result = $this->tpdo->executeSql($sql, $values); + $result = $this->tpdo->getLastInsertId(); + return intval($result); + } + //-------------------------------------------------------------------------------- + public function update ( Acesso_menuVO $objVo ) + { + $values = array( $objVo->getNom_menu() + ,$objVo->getIdmenu_pai() + ,$objVo->getUrl() + ,$objVo->getTooltip() + ,$objVo->getImg_menu() + ,$objVo->getImgdisabled() + ,$objVo->getDisabled() + ,$objVo->getHotkey() + ,$objVo->getBoolseparator() + ,$objVo->getJsonparams() + ,$objVo->getSit_ativo() + ,$objVo->getIdmenu() ); + $sql = 'update form_exemplo.acesso_menu set + nom_menu = ? + ,idmenu_pai = ? + ,url = ? + ,tooltip = ? + ,img_menu = ? + ,imgdisabled = ? + ,disabled = ? + ,hotkey = ? + ,boolseparator = ? + ,jsonparams = ? + ,sit_ativo = ? + where idmenu = ?'; + $result = $this->tpdo->executeSql($sql, $values); + return intval($result); + } + //-------------------------------------------------------------------------------- + public function delete( $id ) + { + FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__); + $values = array($id); + $sql = 'delete from form_exemplo.acesso_menu where idmenu = ?'; + $result = $this->tpdo->executeSql($sql, $values); + return $result; + } + //-------------------------------------------------------------------------------- + public function getVoById( $id ) + { + FormDinHelper::validateIdIsNumeric($id,__METHOD__,__LINE__); + $result = $this->selectById( $id ); + $result = \ArrayHelper::convertArrayFormDin2Pdo($result,false); + $result = $result[0]; + $vo = new Acesso_menuVO(); + $vo = \FormDinHelper::setPropertyVo($result,$vo); + return $vo; + } +} ?> \ No newline at end of file diff --git a/appexemplo_v2.5/dao/Acesso_perfilDAO.class.php b/appexemplo_v2.5/dao/Acesso_perfilDAO.class.php index 89cd1445..986d1b1b 100644 --- a/appexemplo_v2.5/dao/Acesso_perfilDAO.class.php +++ b/appexemplo_v2.5/dao/Acesso_perfilDAO.class.php @@ -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 { @@ -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(); } @@ -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; @@ -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); @@ -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 ) @@ -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); @@ -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]; diff --git a/appexemplo_v2.5/dao/Acesso_perfil_menuDAO.class.php b/appexemplo_v2.5/dao/Acesso_perfil_menuDAO.class.php index d8d79bfe..115f204f 100644 --- a/appexemplo_v2.5/dao/Acesso_perfil_menuDAO.class.php +++ b/appexemplo_v2.5/dao/Acesso_perfil_menuDAO.class.php @@ -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 { @@ -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(); } @@ -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; @@ -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); @@ -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 ) @@ -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); @@ -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]; diff --git a/appexemplo_v2.5/dao/Acesso_perfil_userDAO.class.php b/appexemplo_v2.5/dao/Acesso_perfil_userDAO.class.php index bc950226..7dbe164d 100644 --- a/appexemplo_v2.5/dao/Acesso_perfil_userDAO.class.php +++ b/appexemplo_v2.5/dao/Acesso_perfil_userDAO.class.php @@ -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 { @@ -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(); } @@ -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; @@ -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); @@ -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 ) @@ -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); @@ -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); @@ -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]; diff --git a/appexemplo_v2.5/dao/Acesso_userDAO.class.php b/appexemplo_v2.5/dao/Acesso_userDAO.class.php index 98fe70f5..15b146c7 100644 --- a/appexemplo_v2.5/dao/Acesso_userDAO.class.php +++ b/appexemplo_v2.5/dao/Acesso_userDAO.class.php @@ -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 { @@ -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(); } @@ -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; @@ -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); @@ -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 ) @@ -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 ) @@ -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); @@ -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]; diff --git a/appexemplo_v2.5/dao/AutoridadeDAO.class.php b/appexemplo_v2.5/dao/AutoridadeDAO.class.php index b6ffdcbf..6028719a 100644 --- a/appexemplo_v2.5/dao/AutoridadeDAO.class.php +++ b/appexemplo_v2.5/dao/AutoridadeDAO.class.php @@ -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 AutoridadeDAO { @@ -25,7 +25,7 @@ class AutoridadeDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -37,16 +37,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; @@ -65,9 +58,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 idautoridade = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -116,13 +107,14 @@ public function insert( AutoridadeVO $objVo ) , $objVo->getNome_pessoa() ); $sql = 'insert into form_exemplo.autoridade( - dat_evento + dat_evento ,ordem ,cargo ,nome_pessoa ) values (?,?,?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( AutoridadeVO $objVo ) @@ -139,14 +131,12 @@ public function update ( AutoridadeVO $objVo ) ,nome_pessoa = ? where idautoridade = ?'; $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.autoridade where idautoridade = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -155,9 +145,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]; diff --git a/appexemplo_v2.5/dao/EnderecoDAO.class.php b/appexemplo_v2.5/dao/EnderecoDAO.class.php index 77b777b3..c2ef01a6 100644 --- a/appexemplo_v2.5/dao/EnderecoDAO.class.php +++ b/appexemplo_v2.5/dao/EnderecoDAO.class.php @@ -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 EnderecoDAO { @@ -23,13 +23,15 @@ class EnderecoDAO ,complemento ,bairro ,cidade + ,dat_inclusao + ,dat_alteracao from form_exemplo.endereco '; private $tpdo = null; public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -41,16 +43,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; @@ -73,9 +68,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 idendereco = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -140,7 +133,8 @@ public function insert( EnderecoVO $objVo ) ,cidade ) values (?,?,?,?,?,?,?,?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( EnderecoVO $objVo ) @@ -167,14 +161,12 @@ public function update ( EnderecoVO $objVo ) ,cidade = ? where idendereco = ?'; $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.endereco where idendereco = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -183,9 +175,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]; diff --git a/appexemplo_v2.5/dao/MarcaDAO.class.php b/appexemplo_v2.5/dao/MarcaDAO.class.php index 290d41ea..3ddfbbc5 100644 --- a/appexemplo_v2.5/dao/MarcaDAO.class.php +++ b/appexemplo_v2.5/dao/MarcaDAO.class.php @@ -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 MarcaDAO { @@ -23,7 +23,7 @@ class MarcaDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -35,16 +35,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; @@ -60,9 +53,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 idmarca = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -113,7 +104,8 @@ public function insert( MarcaVO $objVo ) ,idpessoa ) values (?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( MarcaVO $objVo ) @@ -126,14 +118,12 @@ public function update ( MarcaVO $objVo ) ,idpessoa = ? where idmarca = ?'; $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.marca where idmarca = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -142,9 +132,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]; diff --git a/appexemplo_v2.5/dao/Meta_tipoDAO.class.php b/appexemplo_v2.5/dao/Meta_tipoDAO.class.php index d7d285c1..da49ad96 100644 --- a/appexemplo_v2.5/dao/Meta_tipoDAO.class.php +++ b/appexemplo_v2.5/dao/Meta_tipoDAO.class.php @@ -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 Meta_tipoDAO { @@ -25,7 +25,7 @@ class Meta_tipoDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -37,16 +37,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; @@ -62,9 +55,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 idmetatipo = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -115,7 +106,8 @@ public function insert( Meta_tipoVO $objVo ) ,sit_ativo ) values (?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( Meta_tipoVO $objVo ) @@ -128,14 +120,12 @@ public function update ( Meta_tipoVO $objVo ) ,sit_ativo = ? where idmetatipo = ?'; $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.meta_tipo where idmetatipo = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -144,9 +134,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]; diff --git a/appexemplo_v2.5/dao/MunicipioDAO.class.php b/appexemplo_v2.5/dao/MunicipioDAO.class.php index 7fa41247..28c3154d 100644 --- a/appexemplo_v2.5/dao/MunicipioDAO.class.php +++ b/appexemplo_v2.5/dao/MunicipioDAO.class.php @@ -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:31 + * System appev2 created in: 2019-11-01 22:23:15 */ class MunicipioDAO { @@ -24,7 +24,7 @@ class MunicipioDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -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; @@ -62,9 +55,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 cod_municipio = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -117,7 +108,8 @@ public function insert( MunicipioVO $objVo ) ,sit_ativo ) values (?,?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( MunicipioVO $objVo ) @@ -132,14 +124,12 @@ public function update ( MunicipioVO $objVo ) ,sit_ativo = ? where cod_municipio = ?'; $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.municipio where cod_municipio = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -148,9 +138,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]; diff --git a/appexemplo_v2.5/dao/Natureza_juridicaDAO.class.php b/appexemplo_v2.5/dao/Natureza_juridicaDAO.class.php index 9c70f15a..3545b067 100644 --- a/appexemplo_v2.5/dao/Natureza_juridicaDAO.class.php +++ b/appexemplo_v2.5/dao/Natureza_juridicaDAO.class.php @@ -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:31 + * System appev2 created in: 2019-11-01 22:23:15 */ class Natureza_juridicaDAO { @@ -22,7 +22,7 @@ class Natureza_juridicaDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -34,16 +34,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; @@ -59,9 +52,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 idnatureza_juridica = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -112,7 +103,8 @@ public function insert( Natureza_juridicaVO $objVo ) ,administradores ) values (?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( Natureza_juridicaVO $objVo ) @@ -125,14 +117,12 @@ public function update ( Natureza_juridicaVO $objVo ) ,administradores = ? where idnatureza_juridica = ?'; $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.natureza_juridica where idnatureza_juridica = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -141,9 +131,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]; diff --git a/appexemplo_v2.5/dao/Pedido_itemDAO.class.php b/appexemplo_v2.5/dao/Pedido_itemDAO.class.php index 81f95058..60f0c34b 100644 --- a/appexemplo_v2.5/dao/Pedido_itemDAO.class.php +++ b/appexemplo_v2.5/dao/Pedido_itemDAO.class.php @@ -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:31 + * System appev2 created in: 2019-11-01 22:23:15 */ class Pedido_itemDAO { @@ -24,7 +24,7 @@ class Pedido_itemDAO public function __construct($tpdo=null) { - $this->validateObjType($tpdo); + FormDinHelper::validateObjTypeTPDOConnectionObj($tpdo,__METHOD__,__LINE__); if( empty($tpdo) ){ $tpdo = New TPDOConnectionObj(); } @@ -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; @@ -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 idpedido_item = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -120,7 +111,8 @@ public function insert( Pedido_itemVO $objVo ) ,preco ) values (?,?,?,?)'; $result = $this->tpdo->executeSql($sql, $values); - return $result; + $result = $this->tpdo->getLastInsertId(); + return intval($result); } //-------------------------------------------------------------------------------- public function update ( Pedido_itemVO $objVo ) @@ -137,14 +129,12 @@ public function update ( Pedido_itemVO $objVo ) ,preco = ? where idpedido_item = ?'; $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.pedido_item where idpedido_item = ?'; $result = $this->tpdo->executeSql($sql, $values); @@ -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];