/**
  * Instantiate a RoleEntityQtypeBuiltInAuthorization from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this RoleEntityQtypeBuiltInAuthorization::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param QDatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $objPreviousItem
  * @param string[] $strColumnAliasArray
  * @return RoleEntityQtypeBuiltInAuthorization
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array())
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the RoleEntityQtypeBuiltInAuthorization object
     $objToReturn = new RoleEntityQtypeBuiltInAuthorization();
     $objToReturn->__blnRestored = true;
     $strAliasName = array_key_exists($strAliasPrefix . 'role_entity_built_in_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_entity_built_in_id'] : $strAliasPrefix . 'role_entity_built_in_id';
     $objToReturn->intRoleEntityBuiltInId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'role_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_id'] : $strAliasPrefix . 'role_id';
     $objToReturn->intRoleId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'entity_qtype_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'entity_qtype_id'] : $strAliasPrefix . 'entity_qtype_id';
     $objToReturn->intEntityQtypeId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'authorization_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorization_id'] : $strAliasPrefix . 'authorization_id';
     $objToReturn->intAuthorizationId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'authorized_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorized_flag'] : $strAliasPrefix . 'authorized_flag';
     $objToReturn->blnAuthorizedFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
     $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by';
     $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date';
     $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
     $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by';
     $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date';
     $objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasName, 'VarChar');
     // Instantiate Virtual Attributes
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         $strVirtualPrefix = $strAliasPrefix . '__';
         $strVirtualPrefixLength = strlen($strVirtualPrefix);
         if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'role_entity_qtype_built_in_authorization__';
     }
     // Check for Role Early Binding
     $strAlias = $strAliasPrefix . 'role_id__role_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objRole = Role::InstantiateDbRow($objDbRow, $strAliasPrefix . 'role_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Authorization Early Binding
     $strAlias = $strAliasPrefix . 'authorization_id__authorization_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objAuthorization = Authorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for CreatedByObject Early Binding
     $strAlias = $strAliasPrefix . 'created_by__user_account_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for ModifiedByObject Early Binding
     $strAlias = $strAliasPrefix . 'modified_by__user_account_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     return $objToReturn;
 }
コード例 #2
0
 /**
  * Instantiate a Shortcut from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this Shortcut::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param QDatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $objPreviousItem
  * @param string[] $strColumnAliasArray
  * @return Shortcut
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array())
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the Shortcut object
     $objToReturn = new Shortcut();
     $objToReturn->__blnRestored = true;
     $strAliasName = array_key_exists($strAliasPrefix . 'shortcut_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'shortcut_id'] : $strAliasPrefix . 'shortcut_id';
     $objToReturn->intShortcutId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'module_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'module_id'] : $strAliasPrefix . 'module_id';
     $objToReturn->intModuleId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'authorization_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorization_id'] : $strAliasPrefix . 'authorization_id';
     $objToReturn->intAuthorizationId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'transaction_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_type_id'] : $strAliasPrefix . 'transaction_type_id';
     $objToReturn->intTransactionTypeId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description';
     $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar');
     $strAliasName = array_key_exists($strAliasPrefix . 'link', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'link'] : $strAliasPrefix . 'link';
     $objToReturn->strLink = $objDbRow->GetColumn($strAliasName, 'VarChar');
     $strAliasName = array_key_exists($strAliasPrefix . 'image_path', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_path'] : $strAliasPrefix . 'image_path';
     $objToReturn->strImagePath = $objDbRow->GetColumn($strAliasName, 'VarChar');
     $strAliasName = array_key_exists($strAliasPrefix . 'entity_qtype_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'entity_qtype_id'] : $strAliasPrefix . 'entity_qtype_id';
     $objToReturn->intEntityQtypeId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'create_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'create_flag'] : $strAliasPrefix . 'create_flag';
     $objToReturn->blnCreateFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
     // Instantiate Virtual Attributes
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         $strVirtualPrefix = $strAliasPrefix . '__';
         $strVirtualPrefixLength = strlen($strVirtualPrefix);
         if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'shortcut__';
     }
     // Check for Module Early Binding
     $strAlias = $strAliasPrefix . 'module_id__module_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objModule = Module::InstantiateDbRow($objDbRow, $strAliasPrefix . 'module_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Authorization Early Binding
     $strAlias = $strAliasPrefix . 'authorization_id__authorization_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objAuthorization = Authorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for TransactionType Early Binding
     $strAlias = $strAliasPrefix . 'transaction_type_id__transaction_type_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objTransactionType = TransactionType::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transaction_type_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     return $objToReturn;
 }
コード例 #3
0
 /**
  * Instantiate an array of Authorizations from a Database Result
  * @param DatabaseResultBase $objDbResult
  * @return Authorization[]
  */
 public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null)
 {
     $objToReturn = array();
     // If blank resultset, then return empty array
     if (!$objDbResult) {
         return $objToReturn;
     }
     // Load up the return array with each row
     if ($strExpandAsArrayNodes) {
         $objLastRowItem = null;
         while ($objDbRow = $objDbResult->GetNextRow()) {
             $objItem = Authorization::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem);
             if ($objItem) {
                 array_push($objToReturn, $objItem);
                 $objLastRowItem = $objItem;
             }
         }
     } else {
         while ($objDbRow = $objDbResult->GetNextRow()) {
             array_push($objToReturn, Authorization::InstantiateDbRow($objDbRow));
         }
     }
     return $objToReturn;
 }
コード例 #4
0
 /**
  * Instantiate a RoleModuleAuthorization from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this RoleModuleAuthorization::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return RoleModuleAuthorization
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the RoleModuleAuthorization object
     $objToReturn = new RoleModuleAuthorization();
     $objToReturn->__blnRestored = true;
     $objToReturn->intRoleModuleAuthorizationId = $objDbRow->GetColumn($strAliasPrefix . 'role_module_authorization_id', 'Integer');
     $objToReturn->intRoleModuleId = $objDbRow->GetColumn($strAliasPrefix . 'role_module_id', 'Integer');
     $objToReturn->intAuthorizationId = $objDbRow->GetColumn($strAliasPrefix . 'authorization_id', 'Integer');
     $objToReturn->intAuthorizationLevelId = $objDbRow->GetColumn($strAliasPrefix . 'authorization_level_id', 'Integer');
     $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasPrefix . 'created_by', 'Integer');
     $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasPrefix . 'creation_date', 'DateTime');
     $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasPrefix . 'modified_by', 'Integer');
     $objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasPrefix . 'modified_date', 'VarChar');
     // Instantiate Virtual Attributes
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         $strVirtualPrefix = $strAliasPrefix . '__';
         $strVirtualPrefixLength = strlen($strVirtualPrefix);
         if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'role_module_authorization__';
     }
     // Check for RoleModule Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'role_module_id__role_module_id'))) {
         $objToReturn->objRoleModule = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'role_module_id__', $strExpandAsArrayNodes);
     }
     // Check for Authorization Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'authorization_id__authorization_id'))) {
         $objToReturn->objAuthorization = Authorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_id__', $strExpandAsArrayNodes);
     }
     // Check for AuthorizationLevel Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'authorization_level_id__authorization_level_id'))) {
         $objToReturn->objAuthorizationLevel = AuthorizationLevel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_level_id__', $strExpandAsArrayNodes);
     }
     // Check for CreatedByObject Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'created_by__user_account_id'))) {
         $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes);
     }
     // Check for ModifiedByObject Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'modified_by__user_account_id'))) {
         $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes);
     }
     return $objToReturn;
 }
コード例 #5
0
 /**
  * Instantiate a single Authorization object from a query cursor (e.g. a DB ResultSet).
  * Cursor is automatically moved to the "next row" of the result set.
  * Will return NULL if no cursor or if the cursor has no more rows in the resultset.
  * @param QDatabaseResultBase $objDbResult cursor resource
  * @return Authorization next row resulting from the query
  */
 public static function InstantiateCursor(QDatabaseResultBase $objDbResult)
 {
     // If blank resultset, then return empty result
     if (!$objDbResult) {
         return null;
     }
     // If empty resultset, then return empty result
     $objDbRow = $objDbResult->GetNextRow();
     if (!$objDbRow) {
         return null;
     }
     // We need the Column Aliases
     $strColumnAliasArray = $objDbResult->QueryBuilder->ColumnAliasArray;
     if (!$strColumnAliasArray) {
         $strColumnAliasArray = array();
     }
     // Pull Expansions (if applicable)
     $strExpandAsArrayNodes = $objDbResult->QueryBuilder->ExpandAsArrayNodes;
     // Load up the return result with a row and return it
     return Authorization::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray);
 }