. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ /** * @access public */ require_once 'classes/model/om/BaseSystems.php'; /** * Skeleton subclass for representing a row from the 'SYSTEMS' table. * * * * You should add additional methods to this class to meet the * application requirements. This class will only be generated as * long as it does not already exist in the output directory. * * @package rbac-classes-model */ class Systems extends BaseSystems { /** * Load the Application row specified in [app_id] column value. * * param string $AppUid the uid of the application * return array $Fields the fields * Function Load * access public */ function Load ( $SysUid ) { $con = Propel::getConnection(SystemsPeer::DATABASE_NAME); try { $oSystem = SystemsPeer::retrieveByPk( $SysUid ); if (is_object($oSystem) && get_class ($oSystem) == 'Systems' ) { $aFields = $oSystem->toArray(BasePeer::TYPE_FIELDNAME); $this->fromArray ($aFields, BasePeer::TYPE_FIELDNAME ); return $aFields; } else { throw( new Exception( "This Systems row doesn't exist!" )); } } catch (Exception $oError) { throw($oError); } } function LoadByCode ( $SysUid ) { $con = Propel::getConnection(SystemsPeer::DATABASE_NAME); try { $c = new Criteria( 'rbac' ); $c->add ( SystemsPeer::SYS_CODE, $SysUid ); $rs = SystemsPeer::doSelect( $c ); if ( is_array($rs) && isset( $rs[0] ) && is_object($rs[0]) && get_class ( $rs[0] ) == 'Systems' ) { $aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME); $this->fromArray ($aFields, BasePeer::TYPE_FIELDNAME ); return $aFields; } else { throw( new Exception( "This Systems row doesn't exist!" )); } } catch (Exception $oError) { throw($oError); } } function create ( $aData ) { $con = Propel::getConnection(SystemsPeer::DATABASE_NAME); try { $SysUid = $aData['SYS_CODE']; $c = new Criteria( 'rbac' ); $c->add ( SystemsPeer::SYS_CODE, $SysUid ); $rs = SystemsPeer::doSelect( $c ); $exists = ( is_array($rs) && isset( $rs[0] ) && is_object($rs[0]) && get_class ( $rs[0] ) == 'Systems' ); if ( $exists ) return; $aData['SYS_UID'] = G::generateUniqueId(); $aData['SYS_CREATE_DATE'] = date ('Y-m-d H:i:s'); $aData['SYS_UPDATE_DATE'] = date ('Y-m-d H:i:s'); $aData['SYS_STATUS'] = '1'; $this->fromArray($aData, BasePeer::TYPE_FIELDNAME); if ($this->validate()) { $result = $this->save(); } else { $e = new Exception("Failed Validation in class " . get_class($this) . "."); $e->aValidationFailures = $this->getValidationFailures(); throw ($e); } $con->commit(); return $result; } catch (exception $e) { $con->rollback(); throw ($e); } } } // Systems