本文整理汇总了PHP中Country::InstantiateDbRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::InstantiateDbRow方法的具体用法?PHP Country::InstantiateDbRow怎么用?PHP Country::InstantiateDbRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::InstantiateDbRow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstantiateDbRow
/**
* 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');
//.........这里部分代码省略.........
示例2: InstantiateCursor
/**
* 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);
}
示例3: InstantiateDbRow
/**
* 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;
}
示例4: InstantiateDbRow
/**
* 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))) {
//.........这里部分代码省略.........
示例5: InstantiateDbResult
/**
* 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;
}