/** * Instantiate a Address from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Address::InstantiateDbRow in order to perform * early binding on referenced objects. * @param DatabaseRowBase $objDbRow * @param string $strAliasPrefix * @return Address */ 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->intAddressId == $objDbRow->GetColumn($strAliasPrefix . 'address_id', 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'address__'; } if (array_key_exists($strAliasPrefix . 'company__company_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'company__company_id'))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objCompanyArray)) { $objPreviousChildItem = $objPreviousItem->_objCompanyArray[$intPreviousChildItemCount - 1]; $objChildItem = Company::InstantiateDbRow($objDbRow, $strAliasPrefix . 'company__', $strExpandAsArrayNodes, $objPreviousChildItem); if ($objChildItem) { array_push($objPreviousItem->_objCompanyArray, $objChildItem); } } else { array_push($objPreviousItem->_objCompanyArray, Company::InstantiateDbRow($objDbRow, $strAliasPrefix . 'company__', $strExpandAsArrayNodes)); } $blnExpandedViaArray = true; } if (array_key_exists($strAliasPrefix . 'contact__contact_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'contact__contact_id'))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objContactArray)) { $objPreviousChildItem = $objPreviousItem->_objContactArray[$intPreviousChildItemCount - 1]; $objChildItem = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, $objPreviousChildItem); if ($objChildItem) { array_push($objPreviousItem->_objContactArray, $objChildItem); } } else { array_push($objPreviousItem->_objContactArray, Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes)); } $blnExpandedViaArray = true; } if (array_key_exists($strAliasPrefix . 'receiptasto__receipt_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'receiptasto__receipt_id'))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objReceiptAsToArray)) { $objPreviousChildItem = $objPreviousItem->_objReceiptAsToArray[$intPreviousChildItemCount - 1]; $objChildItem = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasto__', $strExpandAsArrayNodes, $objPreviousChildItem); if ($objChildItem) { array_push($objPreviousItem->_objReceiptAsToArray, $objChildItem); } } else { array_push($objPreviousItem->_objReceiptAsToArray, Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasto__', $strExpandAsArrayNodes)); } $blnExpandedViaArray = true; } if (array_key_exists($strAliasPrefix . 'shipmentasfrom__shipment_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'shipmentasfrom__shipment_id'))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objShipmentAsFromArray)) { $objPreviousChildItem = $objPreviousItem->_objShipmentAsFromArray[$intPreviousChildItemCount - 1]; $objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, $objPreviousChildItem); if ($objChildItem) { array_push($objPreviousItem->_objShipmentAsFromArray, $objChildItem); } } else { array_push($objPreviousItem->_objShipmentAsFromArray, Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes)); } $blnExpandedViaArray = true; } if (array_key_exists($strAliasPrefix . 'shipmentasto__shipment_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'shipmentasto__shipment_id'))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objShipmentAsToArray)) { $objPreviousChildItem = $objPreviousItem->_objShipmentAsToArray[$intPreviousChildItemCount - 1]; $objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes, $objPreviousChildItem); if ($objChildItem) { array_push($objPreviousItem->_objShipmentAsToArray, $objChildItem); } } else { array_push($objPreviousItem->_objShipmentAsToArray, Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $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 == 'address__') { $strAliasPrefix = null; } } } // Create a new instance of the Address object $objToReturn = new Address(); $objToReturn->__blnRestored = true; $objToReturn->intAddressId = $objDbRow->GetColumn($strAliasPrefix . 'address_id', 'Integer'); $objToReturn->intCompanyId = $objDbRow->GetColumn($strAliasPrefix . 'company_id', 'Integer'); $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'VarChar'); $objToReturn->intCountryId = $objDbRow->GetColumn($strAliasPrefix . 'country_id', 'Integer'); $objToReturn->strAddress1 = $objDbRow->GetColumn($strAliasPrefix . 'address_1', 'VarChar'); $objToReturn->strAddress2 = $objDbRow->GetColumn($strAliasPrefix . 'address_2', 'VarChar'); $objToReturn->strCity = $objDbRow->GetColumn($strAliasPrefix . 'city', 'VarChar'); $objToReturn->intStateProvinceId = $objDbRow->GetColumn($strAliasPrefix . 'state_province_id', 'Integer'); $objToReturn->strPostalCode = $objDbRow->GetColumn($strAliasPrefix . 'postal_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 = 'address__'; } // Check for Company Early Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'company_id__company_id'))) { $objToReturn->objCompany = Company::InstantiateDbRow($objDbRow, $strAliasPrefix . 'company_id__', $strExpandAsArrayNodes); } // 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 StateProvince Early Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'state_province_id__state_province_id'))) { $objToReturn->objStateProvince = StateProvince::InstantiateDbRow($objDbRow, $strAliasPrefix . 'state_province_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 Company Virtual Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'company__company_id'))) { if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'company__company_id', $strExpandAsArrayNodes)) { array_push($objToReturn->_objCompanyArray, Company::InstantiateDbRow($objDbRow, $strAliasPrefix . 'company__', $strExpandAsArrayNodes)); } else { $objToReturn->_objCompany = Company::InstantiateDbRow($objDbRow, $strAliasPrefix . 'company__', $strExpandAsArrayNodes); } } // Check for Contact Virtual Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'contact__contact_id'))) { if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'contact__contact_id', $strExpandAsArrayNodes)) { array_push($objToReturn->_objContactArray, Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes)); } else { $objToReturn->_objContact = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes); } } // Check for ReceiptAsTo Virtual Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'receiptasto__receipt_id'))) { if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'receiptasto__receipt_id', $strExpandAsArrayNodes)) { array_push($objToReturn->_objReceiptAsToArray, Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasto__', $strExpandAsArrayNodes)); } else { $objToReturn->_objReceiptAsTo = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasto__', $strExpandAsArrayNodes); } } // Check for ShipmentAsFrom Virtual Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'shipmentasfrom__shipment_id'))) { if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'shipmentasfrom__shipment_id', $strExpandAsArrayNodes)) { array_push($objToReturn->_objShipmentAsFromArray, Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes)); } else { $objToReturn->_objShipmentAsFrom = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes); } } // Check for ShipmentAsTo Virtual Binding if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'shipmentasto__shipment_id'))) { if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'shipmentasto__shipment_id', $strExpandAsArrayNodes)) { array_push($objToReturn->_objShipmentAsToArray, Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes)); } else { $objToReturn->_objShipmentAsTo = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes); } } return $objToReturn; }
/** * Instantiate a single Country 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 Country 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 Country::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray); }
/** * 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; }
/** * Instantiate a Person from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Person::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 Person */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // See if we're doing an array expansion on the previous item $strAlias = $strAliasPrefix . 'id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'person__'; } $strAlias = $strAliasPrefix . 'topicasemail__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objTopicAsEmailArray)) { $objPreviousChildItem = $objPreviousItem->_objTopicAsEmailArray[$intPreviousChildItemCount - 1]; $objChildItem = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasemail__topic_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objTopicAsEmailArray[] = $objChildItem; } } else { $objPreviousItem->_objTopicAsEmailArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasemail__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'topicasreadonce__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objTopicAsReadOnceArray)) { $objPreviousChildItem = $objPreviousItem->_objTopicAsReadOnceArray[$intPreviousChildItemCount - 1]; $objChildItem = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasreadonce__topic_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objTopicAsReadOnceArray[] = $objChildItem; } } else { $objPreviousItem->_objTopicAsReadOnceArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasreadonce__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'topicasread__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objTopicAsReadArray)) { $objPreviousChildItem = $objPreviousItem->_objTopicAsReadArray[$intPreviousChildItemCount - 1]; $objChildItem = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasread__topic_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objTopicAsReadArray[] = $objChildItem; } } else { $objPreviousItem->_objTopicAsReadArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasread__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'issueaspostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objIssueAsPostedByArray)) { $objPreviousChildItem = $objPreviousItem->_objIssueAsPostedByArray[$intPreviousChildItemCount - 1]; $objChildItem = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueaspostedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objIssueAsPostedByArray[] = $objChildItem; } } else { $objPreviousItem->_objIssueAsPostedByArray[] = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'issueasassignedto__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objIssueAsAssignedToArray)) { $objPreviousChildItem = $objPreviousItem->_objIssueAsAssignedToArray[$intPreviousChildItemCount - 1]; $objChildItem = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueasassignedto__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objIssueAsAssignedToArray[] = $objChildItem; } } else { $objPreviousItem->_objIssueAsAssignedToArray[] = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueasassignedto__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'issuevote__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objIssueVoteArray)) { $objPreviousChildItem = $objPreviousItem->_objIssueVoteArray[$intPreviousChildItemCount - 1]; $objChildItem = IssueVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuevote__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objIssueVoteArray[] = $objChildItem; } } else { $objPreviousItem->_objIssueVoteArray[] = IssueVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuevote__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'loginticket__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objLoginTicketArray)) { $objPreviousChildItem = $objPreviousItem->_objLoginTicketArray[$intPreviousChildItemCount - 1]; $objChildItem = LoginTicket::InstantiateDbRow($objDbRow, $strAliasPrefix . 'loginticket__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objLoginTicketArray[] = $objChildItem; } } else { $objPreviousItem->_objLoginTicketArray[] = LoginTicket::InstantiateDbRow($objDbRow, $strAliasPrefix . 'loginticket__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'message__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objMessageArray)) { $objPreviousChildItem = $objPreviousItem->_objMessageArray[$intPreviousChildItemCount - 1]; $objChildItem = Message::InstantiateDbRow($objDbRow, $strAliasPrefix . 'message__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objMessageArray[] = $objChildItem; } } else { $objPreviousItem->_objMessageArray[] = Message::InstantiateDbRow($objDbRow, $strAliasPrefix . 'message__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'packageaslastpostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objPackageAsLastPostedByArray)) { $objPreviousChildItem = $objPreviousItem->_objPackageAsLastPostedByArray[$intPreviousChildItemCount - 1]; $objChildItem = Package::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packageaslastpostedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objPackageAsLastPostedByArray[] = $objChildItem; } } else { $objPreviousItem->_objPackageAsLastPostedByArray[] = Package::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packageaslastpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'packagecontribution__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objPackageContributionArray)) { $objPreviousChildItem = $objPreviousItem->_objPackageContributionArray[$intPreviousChildItemCount - 1]; $objChildItem = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objPackageContributionArray[] = $objChildItem; } } else { $objPreviousItem->_objPackageContributionArray[] = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'showcaseitem__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objShowcaseItemArray)) { $objPreviousChildItem = $objPreviousItem->_objShowcaseItemArray[$intPreviousChildItemCount - 1]; $objChildItem = ShowcaseItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'showcaseitem__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objShowcaseItemArray[] = $objChildItem; } } else { $objPreviousItem->_objShowcaseItemArray[] = ShowcaseItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'showcaseitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'topic__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objTopicArray)) { $objPreviousChildItem = $objPreviousItem->_objTopicArray[$intPreviousChildItemCount - 1]; $objChildItem = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topic__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objTopicArray[] = $objChildItem; } } else { $objPreviousItem->_objTopicArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topic__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'wikiitemascurrentpostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objWikiItemAsCurrentPostedByArray)) { $objPreviousChildItem = $objPreviousItem->_objWikiItemAsCurrentPostedByArray[$intPreviousChildItemCount - 1]; $objChildItem = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiitemascurrentpostedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objWikiItemAsCurrentPostedByArray[] = $objChildItem; } } else { $objPreviousItem->_objWikiItemAsCurrentPostedByArray[] = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiitemascurrentpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'wikiversionaspostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) { if ($intPreviousChildItemCount = count($objPreviousItem->_objWikiVersionAsPostedByArray)) { $objPreviousChildItem = $objPreviousItem->_objWikiVersionAsPostedByArray[$intPreviousChildItemCount - 1]; $objChildItem = WikiVersion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiversionaspostedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objWikiVersionAsPostedByArray[] = $objChildItem; } } else { $objPreviousItem->_objWikiVersionAsPostedByArray[] = WikiVersion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiversionaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $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 == 'person__') { $strAliasPrefix = null; } } } // Create a new instance of the Person object $objToReturn = new Person(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id'; $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_type_id'] : $strAliasPrefix . 'person_type_id'; $objToReturn->intPersonTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'username', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'username'] : $strAliasPrefix . 'username'; $objToReturn->strUsername = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'password', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'password'] : $strAliasPrefix . 'password'; $objToReturn->strPassword = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'first_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'first_name'] : $strAliasPrefix . 'first_name'; $objToReturn->strFirstName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'last_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'last_name'] : $strAliasPrefix . 'last_name'; $objToReturn->strLastName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'email', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email'] : $strAliasPrefix . 'email'; $objToReturn->strEmail = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'display_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'display_name'] : $strAliasPrefix . 'display_name'; $objToReturn->strDisplayName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'password_reset_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'password_reset_flag'] : $strAliasPrefix . 'password_reset_flag'; $objToReturn->blnPasswordResetFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'display_real_name_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'display_real_name_flag'] : $strAliasPrefix . 'display_real_name_flag'; $objToReturn->blnDisplayRealNameFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'display_email_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'display_email_flag'] : $strAliasPrefix . 'display_email_flag'; $objToReturn->blnDisplayEmailFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'opt_in_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'opt_in_flag'] : $strAliasPrefix . 'opt_in_flag'; $objToReturn->blnOptInFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'donated_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'donated_flag'] : $strAliasPrefix . 'donated_flag'; $objToReturn->blnDonatedFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'location', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'location'] : $strAliasPrefix . 'location'; $objToReturn->strLocation = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'country_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'country_id'] : $strAliasPrefix . 'country_id'; $objToReturn->intCountryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'url', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'url'] : $strAliasPrefix . 'url'; $objToReturn->strUrl = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'timezone_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'timezone_id'] : $strAliasPrefix . 'timezone_id'; $objToReturn->intTimezoneId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'registration_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'registration_date'] : $strAliasPrefix . 'registration_date'; $objToReturn->dttRegistrationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); // 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 = 'person__'; } // Check for Country Early Binding $strAlias = $strAliasPrefix . 'country_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCountry = Country::InstantiateDbRow($objDbRow, $strAliasPrefix . 'country_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Timezone Early Binding $strAlias = $strAliasPrefix . 'timezone_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objTimezone = Timezone::InstantiateDbRow($objDbRow, $strAliasPrefix . 'timezone_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for TopicAsEmail Virtual Binding $strAlias = $strAliasPrefix . 'topicasemail__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objTopicAsEmailArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasemail__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objTopicAsEmail = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasemail__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for TopicAsReadOnce Virtual Binding $strAlias = $strAliasPrefix . 'topicasreadonce__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objTopicAsReadOnceArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasreadonce__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objTopicAsReadOnce = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasreadonce__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for TopicAsRead Virtual Binding $strAlias = $strAliasPrefix . 'topicasread__topic_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objTopicAsReadArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasread__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objTopicAsRead = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topicasread__topic_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for IssueAsPostedBy Virtual Binding $strAlias = $strAliasPrefix . 'issueaspostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objIssueAsPostedByArray[] = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objIssueAsPostedBy = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for IssueAsAssignedTo Virtual Binding $strAlias = $strAliasPrefix . 'issueasassignedto__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objIssueAsAssignedToArray[] = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueasassignedto__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objIssueAsAssignedTo = Issue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issueasassignedto__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for IssueVote Virtual Binding $strAlias = $strAliasPrefix . 'issuevote__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objIssueVoteArray[] = IssueVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuevote__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objIssueVote = IssueVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuevote__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for LoginTicket Virtual Binding $strAlias = $strAliasPrefix . 'loginticket__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objLoginTicketArray[] = LoginTicket::InstantiateDbRow($objDbRow, $strAliasPrefix . 'loginticket__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objLoginTicket = LoginTicket::InstantiateDbRow($objDbRow, $strAliasPrefix . 'loginticket__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for Message Virtual Binding $strAlias = $strAliasPrefix . 'message__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objMessageArray[] = Message::InstantiateDbRow($objDbRow, $strAliasPrefix . 'message__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objMessage = Message::InstantiateDbRow($objDbRow, $strAliasPrefix . 'message__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for PackageAsLastPostedBy Virtual Binding $strAlias = $strAliasPrefix . 'packageaslastpostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objPackageAsLastPostedByArray[] = Package::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packageaslastpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objPackageAsLastPostedBy = Package::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packageaslastpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for PackageContribution Virtual Binding $strAlias = $strAliasPrefix . 'packagecontribution__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objPackageContributionArray[] = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objPackageContribution = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ShowcaseItem Virtual Binding $strAlias = $strAliasPrefix . 'showcaseitem__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objShowcaseItemArray[] = ShowcaseItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'showcaseitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objShowcaseItem = ShowcaseItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'showcaseitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for Topic Virtual Binding $strAlias = $strAliasPrefix . 'topic__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objTopicArray[] = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topic__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objTopic = Topic::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topic__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for WikiItemAsCurrentPostedBy Virtual Binding $strAlias = $strAliasPrefix . 'wikiitemascurrentpostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objWikiItemAsCurrentPostedByArray[] = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiitemascurrentpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objWikiItemAsCurrentPostedBy = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiitemascurrentpostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for WikiVersionAsPostedBy Virtual Binding $strAlias = $strAliasPrefix . 'wikiversionaspostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objWikiVersionAsPostedByArray[] = WikiVersion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiversionaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objWikiVersionAsPostedBy = WikiVersion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiversionaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate an array of Countries from a Database Result * @param DatabaseResultBase $objDbResult * @param string $strExpandAsArrayNodes * @param string[] $strColumnAliasArray * @return Country[] */ public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) { $objToReturn = array(); if (!$strColumnAliasArray) { $strColumnAliasArray = 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 = Country::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem, $strColumnAliasArray); if ($objItem) { $objToReturn[] = $objItem; $objLastRowItem = $objItem; } } } else { while ($objDbRow = $objDbResult->GetNextRow()) { $objToReturn[] = Country::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray); } } return $objToReturn; }