/**
  * Instantiate an array of FedexShipments from a Database Result
  * @param DatabaseResultBase $objDbResult
  * @return FedexShipment[]
  */
 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 = FedexShipment::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem);
             if ($objItem) {
                 array_push($objToReturn, $objItem);
                 $objLastRowItem = $objItem;
             }
         }
     } else {
         while ($objDbRow = $objDbResult->GetNextRow()) {
             array_push($objToReturn, FedexShipment::InstantiateDbRow($objDbRow));
         }
     }
     return $objToReturn;
 }
 /**
  * Instantiate a ShippingAccount from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this ShippingAccount::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return ShippingAccount
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // See if we're doing an array expansion on the previous item
     if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intShippingAccountId == $objDbRow->GetColumn($strAliasPrefix . 'shipping_account_id', 'Integer')) {
         // We are.  Now, prepare to check for ExpandAsArray clauses
         $blnExpandedViaArray = false;
         if (!$strAliasPrefix) {
             $strAliasPrefix = 'shipping_account__';
         }
         if (array_key_exists($strAliasPrefix . 'fedexshipment__fedex_shipment_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'fedexshipment__fedex_shipment_id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objFedexShipmentArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objFedexShipmentArray[$intPreviousChildItemCount - 1];
                 $objChildItem = FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipment__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objFedexShipmentArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objFedexShipmentArray, FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipment__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
         if ($blnExpandedViaArray) {
             return false;
         } else {
             if ($strAliasPrefix == 'shipping_account__') {
                 $strAliasPrefix = null;
             }
         }
     }
     // Create a new instance of the ShippingAccount object
     $objToReturn = new ShippingAccount();
     $objToReturn->__blnRestored = true;
     $objToReturn->intShippingAccountId = $objDbRow->GetColumn($strAliasPrefix . 'shipping_account_id', 'Integer');
     $objToReturn->intCourierId = $objDbRow->GetColumn($strAliasPrefix . 'courier_id', 'Integer');
     $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'VarChar');
     $objToReturn->strAccessId = $objDbRow->GetColumn($strAliasPrefix . 'access_id', 'VarChar');
     $objToReturn->strAccessCode = $objDbRow->GetColumn($strAliasPrefix . 'access_code', 'VarChar');
     $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 = 'shipping_account__';
     }
     // Check for Courier Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'courier_id__courier_id'))) {
         $objToReturn->objCourier = Courier::InstantiateDbRow($objDbRow, $strAliasPrefix . 'courier_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);
     }
     // Check for FedexShipment Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'fedexshipment__fedex_shipment_id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'fedexshipment__fedex_shipment_id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objFedexShipmentArray, FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipment__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objFedexShipment = FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipment__', $strExpandAsArrayNodes);
         }
     }
     return $objToReturn;
 }
 /**
  * Instantiate a StateProvince from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this StateProvince::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return StateProvince
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // See if we're doing an array expansion on the previous item
     if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intStateProvinceId == $objDbRow->GetColumn($strAliasPrefix . 'state_province_id', 'Integer')) {
         // We are.  Now, prepare to check for ExpandAsArray clauses
         $blnExpandedViaArray = false;
         if (!$strAliasPrefix) {
             $strAliasPrefix = 'state_province__';
         }
         if (array_key_exists($strAliasPrefix . 'address__address_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'address__address_id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objAddressArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objAddressArray[$intPreviousChildItemCount - 1];
                 $objChildItem = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objAddressArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objAddressArray, Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'fedexshipmentasholdatlocationstate__fedex_shipment_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'fedexshipmentasholdatlocationstate__fedex_shipment_id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objFedexShipmentAsHoldAtLocationStateArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objFedexShipmentAsHoldAtLocationStateArray[$intPreviousChildItemCount - 1];
                 $objChildItem = FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipmentasholdatlocationstate__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objFedexShipmentAsHoldAtLocationStateArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objFedexShipmentAsHoldAtLocationStateArray, FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipmentasholdatlocationstate__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
         if ($blnExpandedViaArray) {
             return false;
         } else {
             if ($strAliasPrefix == 'state_province__') {
                 $strAliasPrefix = null;
             }
         }
     }
     // Create a new instance of the StateProvince object
     $objToReturn = new StateProvince();
     $objToReturn->__blnRestored = true;
     $objToReturn->intStateProvinceId = $objDbRow->GetColumn($strAliasPrefix . 'state_province_id', 'Integer');
     $objToReturn->intCountryId = $objDbRow->GetColumn($strAliasPrefix . 'country_id', 'Integer');
     $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'VarChar');
     $objToReturn->strAbbreviation = $objDbRow->GetColumn($strAliasPrefix . 'abbreviation', '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 = 'state_province__';
     }
     // Check for Country Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'country_id__country_id'))) {
         $objToReturn->objCountry = Country::InstantiateDbRow($objDbRow, $strAliasPrefix . 'country_id__', $strExpandAsArrayNodes);
     }
     // Check for Address Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'address__address_id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'address__address_id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objAddressArray, Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objAddress = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes);
         }
     }
     // Check for FedexShipmentAsHoldAtLocationState Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'fedexshipmentasholdatlocationstate__fedex_shipment_id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'fedexshipmentasholdatlocationstate__fedex_shipment_id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objFedexShipmentAsHoldAtLocationStateArray, FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipmentasholdatlocationstate__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objFedexShipmentAsHoldAtLocationState = FedexShipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'fedexshipmentasholdatlocationstate__', $strExpandAsArrayNodes);
         }
     }
     return $objToReturn;
 }