本文整理汇总了PHP中AttributeValue::InstantiateDbRow方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeValue::InstantiateDbRow方法的具体用法?PHP AttributeValue::InstantiateDbRow怎么用?PHP AttributeValue::InstantiateDbRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeValue
的用法示例。
在下文中一共展示了AttributeValue::InstantiateDbRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstantiateCursor
/**
* Instantiate a single AttributeValue 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 AttributeValue 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 AttributeValue::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
示例2: 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 . 'checkingaccountlookup__checking_account_lookup_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->_objCheckingAccountLookupArray)) {
$objPreviousChildItem = $objPreviousItem->_objCheckingAccountLookupArray[$intPreviousChildItemCount - 1];
$objChildItem = CheckingAccountLookup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'checkingaccountlookup__checking_account_lookup_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objCheckingAccountLookupArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objCheckingAccountLookupArray[] = CheckingAccountLookup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'checkingaccountlookup__checking_account_lookup_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'communicationlist__communication_list_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->_objCommunicationListArray)) {
$objPreviousChildItem = $objPreviousItem->_objCommunicationListArray[$intPreviousChildItemCount - 1];
$objChildItem = CommunicationList::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlist__communication_list_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objCommunicationListArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objCommunicationListArray[] = CommunicationList::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlist__communication_list_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'nameitem__name_item_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->_objNameItemArray)) {
$objPreviousChildItem = $objPreviousItem->_objNameItemArray[$intPreviousChildItemCount - 1];
$objChildItem = NameItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'nameitem__name_item_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objNameItemArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objNameItemArray[] = NameItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'nameitem__name_item_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'address__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->_objAddressArray)) {
$objPreviousChildItem = $objPreviousItem->_objAddressArray[$intPreviousChildItemCount - 1];
$objChildItem = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAddressArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAddressArray[] = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'attributevalue__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->_objAttributeValueArray)) {
$objPreviousChildItem = $objPreviousItem->_objAttributeValueArray[$intPreviousChildItemCount - 1];
$objChildItem = AttributeValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributevalue__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAttributeValueArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAttributeValueArray[] = AttributeValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributevalue__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'classregistration__signup_entry_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) {
//.........这里部分代码省略.........
示例3: InstantiateDbRow
/**
* Instantiate a Attribute from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Attribute::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 Attribute
*/
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 = 'attribute__';
}
$strAlias = $strAliasPrefix . 'attributeoption__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->_objAttributeOptionArray)) {
$objPreviousChildItem = $objPreviousItem->_objAttributeOptionArray[$intPreviousChildItemCount - 1];
$objChildItem = AttributeOption::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributeoption__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAttributeOptionArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAttributeOptionArray[] = AttributeOption::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributeoption__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'attributevalue__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->_objAttributeValueArray)) {
$objPreviousChildItem = $objPreviousItem->_objAttributeValueArray[$intPreviousChildItemCount - 1];
$objChildItem = AttributeValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributevalue__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAttributeValueArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAttributeValueArray[] = AttributeValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributevalue__', $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 == 'attribute__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Attribute object
$objToReturn = new Attribute();
$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 . 'attribute_data_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'attribute_data_type_id'] : $strAliasPrefix . 'attribute_data_type_id';
$objToReturn->intAttributeDataTypeId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name';
$objToReturn->strName = $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 = 'attribute__';
}
// Check for AttributeOption Virtual Binding
$strAlias = $strAliasPrefix . 'attributeoption__id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) {
$objToReturn->_objAttributeOptionArray[] = AttributeOption::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributeoption__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
} else {
$objToReturn->_objAttributeOption = AttributeOption::InstantiateDbRow($objDbRow, $strAliasPrefix . 'attributeoption__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
}
// Check for AttributeValue Virtual Binding
$strAlias = $strAliasPrefix . 'attributevalue__id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) {
//.........这里部分代码省略.........