本文整理汇总了PHP中UserAccount::InstantiateDbRow方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::InstantiateDbRow方法的具体用法?PHP UserAccount::InstantiateDbRow怎么用?PHP UserAccount::InstantiateDbRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::InstantiateDbRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstantiateDbRow
/**
* Instantiate a Asset from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Asset::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Asset
*/
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->intAssetId == $objDbRow->GetColumn($strAliasPrefix . 'asset_id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'asset__';
}
if (array_key_exists($strAliasPrefix . 'assettransaction__asset_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransaction__asset_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetTransactionArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetTransactionArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetTransactionArray, AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'assettransactionasnew__asset_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransactionasnew__asset_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetTransactionAsNewArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionAsNewArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasnew__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetTransactionAsNewArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetTransactionAsNewArray, AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasnew__', $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 == 'asset__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Asset object
$objToReturn = new Asset();
$objToReturn->__blnRestored = true;
$objToReturn->intAssetId = $objDbRow->GetColumn($strAliasPrefix . 'asset_id', 'Integer');
$objToReturn->intAssetModelId = $objDbRow->GetColumn($strAliasPrefix . 'asset_model_id', 'Integer');
$objToReturn->intLocationId = $objDbRow->GetColumn($strAliasPrefix . 'location_id', 'Integer');
$objToReturn->strAssetCode = $objDbRow->GetColumn($strAliasPrefix . 'asset_code', 'VarChar');
$objToReturn->strImagePath = $objDbRow->GetColumn($strAliasPrefix . 'image_path', 'VarChar');
$objToReturn->blnCheckedOutFlag = $objDbRow->GetColumn($strAliasPrefix . 'checked_out_flag', 'Bit');
$objToReturn->blnReservedFlag = $objDbRow->GetColumn($strAliasPrefix . 'reserved_flag', 'Bit');
$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 = 'asset__';
}
// Check for AssetModel Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'asset_model_id__asset_model_id'))) {
$objToReturn->objAssetModel = AssetModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'asset_model_id__', $strExpandAsArrayNodes);
}
// Check for Location Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'location_id__location_id'))) {
$objToReturn->objLocation = Location::InstantiateDbRow($objDbRow, $strAliasPrefix . 'location_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 AssetTransaction Virtual Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransaction__asset_transaction_id'))) {
if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'assettransaction__asset_transaction_id', $strExpandAsArrayNodes)) {
//.........这里部分代码省略.........
示例2: InstantiateDbRow
/**
* Instantiate a Asset from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Asset::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 Asset
*/
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 . 'asset_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intAssetId == $objDbRow->GetColumn($strAliasName, 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'asset__';
}
$strAlias = $strAliasPrefix . 'childasset__asset_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->_objChildAssetArray)) {
$objPreviousChildItem = $objPreviousItem->_objChildAssetArray[$intPreviousChildItemCount - 1];
$objChildItem = Asset::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childasset__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objChildAssetArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objChildAssetArray[] = Asset::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childasset__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'assettransaction__asset_transaction_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->_objAssetTransactionArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAssetTransactionArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAssetTransactionArray[] = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'assettransactionasnew__asset_transaction_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->_objAssetTransactionAsNewArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionAsNewArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasnew__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objAssetTransactionAsNewArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objAssetTransactionAsNewArray[] = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasnew__', $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 == 'asset__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Asset object
$objToReturn = new Asset();
$objToReturn->__blnRestored = true;
$strAliasName = array_key_exists($strAliasPrefix . 'asset_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_id'] : $strAliasPrefix . 'asset_id';
$objToReturn->intAssetId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'parent_asset_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_asset_id'] : $strAliasPrefix . 'parent_asset_id';
$objToReturn->intParentAssetId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'asset_model_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_model_id'] : $strAliasPrefix . 'asset_model_id';
$objToReturn->intAssetModelId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'location_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'location_id'] : $strAliasPrefix . 'location_id';
$objToReturn->intLocationId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'asset_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_code'] : $strAliasPrefix . 'asset_code';
$objToReturn->strAssetCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
$strAliasName = array_key_exists($strAliasPrefix . 'image_path', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_path'] : $strAliasPrefix . 'image_path';
$objToReturn->strImagePath = $objDbRow->GetColumn($strAliasName, 'VarChar');
$strAliasName = array_key_exists($strAliasPrefix . 'checked_out_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'checked_out_flag'] : $strAliasPrefix . 'checked_out_flag';
$objToReturn->blnCheckedOutFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
$strAliasName = array_key_exists($strAliasPrefix . 'reserved_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'reserved_flag'] : $strAliasPrefix . 'reserved_flag';
$objToReturn->blnReservedFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
$strAliasName = array_key_exists($strAliasPrefix . 'linked_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'linked_flag'] : $strAliasPrefix . 'linked_flag';
$objToReturn->blnLinkedFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
$strAliasName = array_key_exists($strAliasPrefix . 'archived_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'archived_flag'] : $strAliasPrefix . 'archived_flag';
//.........这里部分代码省略.........
示例3: InstantiateDbRow
/**
* Instantiate a Attachment from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Attachment::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Attachment
*/
public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
{
// If blank row, return null
if (!$objDbRow) {
return null;
}
// Create a new instance of the Attachment object
$objToReturn = new Attachment();
$objToReturn->__blnRestored = true;
$objToReturn->intAttachmentId = $objDbRow->GetColumn($strAliasPrefix . 'attachment_id', 'Integer');
$objToReturn->intEntityQtypeId = $objDbRow->GetColumn($strAliasPrefix . 'entity_qtype_id', 'Integer');
$objToReturn->intEntityId = $objDbRow->GetColumn($strAliasPrefix . 'entity_id', 'Integer');
$objToReturn->strFilename = $objDbRow->GetColumn($strAliasPrefix . 'filename', 'VarChar');
$objToReturn->strTmpFilename = $objDbRow->GetColumn($strAliasPrefix . 'tmp_filename', 'VarChar');
$objToReturn->strFileType = $objDbRow->GetColumn($strAliasPrefix . 'file_type', 'VarChar');
$objToReturn->strPath = $objDbRow->GetColumn($strAliasPrefix . 'path', 'VarChar');
$objToReturn->intSize = $objDbRow->GetColumn($strAliasPrefix . 'SIZE', 'Integer');
$objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasPrefix . 'created_by', 'Integer');
$objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasPrefix . 'creation_date', '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 = 'attachment__';
}
// 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);
}
return $objToReturn;
}
示例4: InstantiateDbRow
/**
* 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;
}
示例5: InstantiateDbRow
/**
* Instantiate a InventoryModel from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this InventoryModel::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return InventoryModel
*/
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->intInventoryModelId == $objDbRow->GetColumn($strAliasPrefix . 'inventory_model_id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'inventory_model__';
}
if (array_key_exists($strAliasPrefix . 'inventorylocation__inventory_location_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorylocation__inventory_location_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objInventoryLocationArray)) {
$objPreviousChildItem = $objPreviousItem->_objInventoryLocationArray[$intPreviousChildItemCount - 1];
$objChildItem = InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objInventoryLocationArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objInventoryLocationArray, InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $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 == 'inventory_model__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the InventoryModel object
$objToReturn = new InventoryModel();
$objToReturn->__blnRestored = true;
$objToReturn->intInventoryModelId = $objDbRow->GetColumn($strAliasPrefix . 'inventory_model_id', 'Integer');
$objToReturn->intCategoryId = $objDbRow->GetColumn($strAliasPrefix . 'category_id', 'Integer');
$objToReturn->intManufacturerId = $objDbRow->GetColumn($strAliasPrefix . 'manufacturer_id', 'Integer');
$objToReturn->strInventoryModelCode = $objDbRow->GetColumn($strAliasPrefix . 'inventory_model_code', 'VarChar');
$objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'VarChar');
$objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasPrefix . 'long_description', 'Blob');
$objToReturn->strImagePath = $objDbRow->GetColumn($strAliasPrefix . 'image_path', 'VarChar');
$objToReturn->fltPrice = $objDbRow->GetColumn($strAliasPrefix . 'price', 'Float');
$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 = 'inventory_model__';
}
// Check for Category Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'category_id__category_id'))) {
$objToReturn->objCategory = Category::InstantiateDbRow($objDbRow, $strAliasPrefix . 'category_id__', $strExpandAsArrayNodes);
}
// Check for Manufacturer Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'manufacturer_id__manufacturer_id'))) {
$objToReturn->objManufacturer = Manufacturer::InstantiateDbRow($objDbRow, $strAliasPrefix . 'manufacturer_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 InventoryLocation Virtual Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorylocation__inventory_location_id'))) {
if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'inventorylocation__inventory_location_id', $strExpandAsArrayNodes)) {
array_push($objToReturn->_objInventoryLocationArray, InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $strExpandAsArrayNodes));
} else {
$objToReturn->_objInventoryLocation = InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $strExpandAsArrayNodes);
}
}
return $objToReturn;
}
示例6: InstantiateDbRow
/**
* Instantiate a Notification from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Notification::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 Notification
*/
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 . 'notification_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intNotificationId == $objDbRow->GetColumn($strAliasName, 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'notification__';
}
$strAlias = $strAliasPrefix . 'notificationuseraccount__notification_user_account_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->_objNotificationUserAccountArray)) {
$objPreviousChildItem = $objPreviousItem->_objNotificationUserAccountArray[$intPreviousChildItemCount - 1];
$objChildItem = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objNotificationUserAccountArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objNotificationUserAccountArray[] = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $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 == 'notification__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Notification object
$objToReturn = new Notification();
$objToReturn->__blnRestored = true;
$strAliasName = array_key_exists($strAliasPrefix . 'notification_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'notification_id'] : $strAliasPrefix . 'notification_id';
$objToReturn->intNotificationId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description';
$objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar');
$strAliasName = array_key_exists($strAliasPrefix . 'long_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'long_description'] : $strAliasPrefix . 'long_description';
$objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasName, 'Blob');
$strAliasName = array_key_exists($strAliasPrefix . 'criteria', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'criteria'] : $strAliasPrefix . 'criteria';
$objToReturn->strCriteria = $objDbRow->GetColumn($strAliasName, 'VarChar');
$strAliasName = array_key_exists($strAliasPrefix . 'frequency', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'frequency'] : $strAliasPrefix . 'frequency';
$objToReturn->strFrequency = $objDbRow->GetColumn($strAliasName, 'VarChar');
$strAliasName = array_key_exists($strAliasPrefix . 'enabled_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'enabled_flag'] : $strAliasPrefix . 'enabled_flag';
$objToReturn->blnEnabledFlag = $objDbRow->GetColumn($strAliasName, 'Bit');
$strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by';
$objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date';
$objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
$strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by';
$objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date';
$objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasName, 'VarChar');
// Instantiate Virtual Attributes
foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
$strVirtualPrefix = $strAliasPrefix . '__';
$strVirtualPrefixLength = strlen($strVirtualPrefix);
if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
}
}
// Prepare to Check for Early/Virtual Binding
if (!$strAliasPrefix) {
$strAliasPrefix = 'notification__';
}
// Check for CreatedByObject Early Binding
$strAlias = $strAliasPrefix . 'created_by__user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for ModifiedByObject Early Binding
$strAlias = $strAliasPrefix . 'modified_by__user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for NotificationUserAccount Virtual Binding
$strAlias = $strAliasPrefix . 'notificationuseraccount__notification_user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
//.........这里部分代码省略.........
示例7: InstantiateDbRow
/**
* Instantiate a DatagridColumnPreference from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this DatagridColumnPreference::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return DatagridColumnPreference
*/
public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
{
// If blank row, return null
if (!$objDbRow) {
return null;
}
// Create a new instance of the DatagridColumnPreference object
$objToReturn = new DatagridColumnPreference();
$objToReturn->__blnRestored = true;
$objToReturn->intDatagridColumnPreferenceId = $objDbRow->GetColumn($strAliasPrefix . 'datagrid_column_preference_id', 'Integer');
$objToReturn->intDatagridId = $objDbRow->GetColumn($strAliasPrefix . 'datagrid_id', 'Integer');
$objToReturn->strColumnName = $objDbRow->GetColumn($strAliasPrefix . 'column_name', 'VarChar');
$objToReturn->intUserAccountId = $objDbRow->GetColumn($strAliasPrefix . 'user_account_id', 'Integer');
$objToReturn->blnDisplayFlag = $objDbRow->GetColumn($strAliasPrefix . 'display_flag', 'Bit');
// Instantiate Virtual Attributes
foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
$strVirtualPrefix = $strAliasPrefix . '__';
$strVirtualPrefixLength = strlen($strVirtualPrefix);
if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
}
}
// Prepare to Check for Early/Virtual Binding
if (!$strAliasPrefix) {
$strAliasPrefix = 'datagrid_column_preference__';
}
// Check for Datagrid Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'datagrid_id__datagrid_id'))) {
$objToReturn->objDatagrid = Datagrid::InstantiateDbRow($objDbRow, $strAliasPrefix . 'datagrid_id__', $strExpandAsArrayNodes);
}
// Check for UserAccount Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'user_account_id__user_account_id'))) {
$objToReturn->objUserAccount = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_account_id__', $strExpandAsArrayNodes);
}
return $objToReturn;
}
示例8: InstantiateDbRow
/**
* Instantiate a Transaction from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Transaction::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Transaction
*/
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->intTransactionId == $objDbRow->GetColumn($strAliasPrefix . 'transaction_id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'transaction__';
}
if (array_key_exists($strAliasPrefix . 'assettransaction__asset_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransaction__asset_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetTransactionArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetTransactionArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetTransactionArray, AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransaction__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'inventorytransaction__inventory_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorytransaction__inventory_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objInventoryTransactionArray)) {
$objPreviousChildItem = $objPreviousItem->_objInventoryTransactionArray[$intPreviousChildItemCount - 1];
$objChildItem = InventoryTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorytransaction__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objInventoryTransactionArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objInventoryTransactionArray, InventoryTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorytransaction__', $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 == 'transaction__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Transaction object
$objToReturn = new Transaction();
$objToReturn->__blnRestored = true;
$objToReturn->intTransactionId = $objDbRow->GetColumn($strAliasPrefix . 'transaction_id', 'Integer');
$objToReturn->intEntityQtypeId = $objDbRow->GetColumn($strAliasPrefix . 'entity_qtype_id', 'Integer');
$objToReturn->intTransactionTypeId = $objDbRow->GetColumn($strAliasPrefix . 'transaction_type_id', 'Integer');
$objToReturn->strNote = $objDbRow->GetColumn($strAliasPrefix . 'note', 'Blob');
$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 = 'transaction__';
}
// Check for TransactionType Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'transaction_type_id__transaction_type_id'))) {
$objToReturn->objTransactionType = TransactionType::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transaction_type_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 Receipt Unique ReverseReference Binding
if ($objDbRow->ColumnExists($strAliasPrefix . 'receipt__receipt_id')) {
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'receipt__receipt_id'))) {
$objToReturn->objReceipt = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receipt__', $strExpandAsArrayNodes);
} else {
// We ATTEMPTED to do an Early Bind but the Object Doesn't Exist
// Let's set to FALSE so that the object knows not to try and re-query again
$objToReturn->objReceipt = false;
}
}
//.........这里部分代码省略.........
示例9: InstantiateDbRow
/**
* Instantiate a InventoryTransaction from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this InventoryTransaction::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return InventoryTransaction
*/
public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
{
// If blank row, return null
if (!$objDbRow) {
return null;
}
// Create a new instance of the InventoryTransaction object
$objToReturn = new InventoryTransaction();
$objToReturn->__blnRestored = true;
$objToReturn->intInventoryTransactionId = $objDbRow->GetColumn($strAliasPrefix . 'inventory_transaction_id', 'Integer');
$objToReturn->intInventoryLocationId = $objDbRow->GetColumn($strAliasPrefix . 'inventory_location_id', 'Integer');
$objToReturn->intTransactionId = $objDbRow->GetColumn($strAliasPrefix . 'transaction_id', 'Integer');
$objToReturn->intQuantity = $objDbRow->GetColumn($strAliasPrefix . 'quantity', 'Integer');
$objToReturn->intSourceLocationId = $objDbRow->GetColumn($strAliasPrefix . 'source_location_id', 'Integer');
$objToReturn->intDestinationLocationId = $objDbRow->GetColumn($strAliasPrefix . 'destination_location_id', 'Integer');
$objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasPrefix . 'created_by', 'Integer');
$objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasPrefix . 'creation_date', 'DateTime');
$objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasPrefix . 'modified_by', 'Integer');
$objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasPrefix . 'modified_date', 'VarChar');
$objToReturn->intLocalWarehouseStock = $objDbRow->GetColumn($strAliasPrefix . 'local_warehouse_stock', 'Integer');
$objToReturn->intBadProductsWarehouseStock = $objDbRow->GetColumn($strAliasPrefix . 'bad_products_warehouse_stock', 'Integer');
$objToReturn->intSampleWarehouseStock = $objDbRow->GetColumn($strAliasPrefix . 'sample_warehouse_stock', 'Integer');
$objToReturn->intRepairWarehouseStock = $objDbRow->GetColumn($strAliasPrefix . 'repair_warehouse_stock', 'Integer');
// 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 = 'inventory_transaction__';
}
// Check for InventoryLocation Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'inventory_location_id__inventory_location_id'))) {
$objToReturn->objInventoryLocation = InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventory_location_id__', $strExpandAsArrayNodes);
}
// Check for Transaction Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'transaction_id__transaction_id'))) {
$objToReturn->objTransaction = Transaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transaction_id__', $strExpandAsArrayNodes);
}
// Check for SourceLocation Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'source_location_id__location_id'))) {
$objToReturn->objSourceLocation = Location::InstantiateDbRow($objDbRow, $strAliasPrefix . 'source_location_id__', $strExpandAsArrayNodes);
}
// Check for DestinationLocation Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'destination_location_id__location_id'))) {
$objToReturn->objDestinationLocation = Location::InstantiateDbRow($objDbRow, $strAliasPrefix . 'destination_location_id__', $strExpandAsArrayNodes);
}
// Check for CreatedByObject Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'created_by__user_account_id'))) {
$objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes);
}
// Check for ModifiedByObject Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'modified_by__user_account_id'))) {
$objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes);
}
return $objToReturn;
}
示例10: InstantiateDbRow
/**
* Instantiate a RoleModuleAuthorization from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this RoleModuleAuthorization::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return RoleModuleAuthorization
*/
public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null)
{
// If blank row, return null
if (!$objDbRow) {
return null;
}
// Create a new instance of the RoleModuleAuthorization object
$objToReturn = new RoleModuleAuthorization();
$objToReturn->__blnRestored = true;
$objToReturn->intRoleModuleAuthorizationId = $objDbRow->GetColumn($strAliasPrefix . 'role_module_authorization_id', 'Integer');
$objToReturn->intRoleModuleId = $objDbRow->GetColumn($strAliasPrefix . 'role_module_id', 'Integer');
$objToReturn->intAuthorizationId = $objDbRow->GetColumn($strAliasPrefix . 'authorization_id', 'Integer');
$objToReturn->intAuthorizationLevelId = $objDbRow->GetColumn($strAliasPrefix . 'authorization_level_id', 'Integer');
$objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasPrefix . 'created_by', 'Integer');
$objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasPrefix . 'creation_date', 'DateTime');
$objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasPrefix . 'modified_by', 'Integer');
$objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasPrefix . 'modified_date', 'VarChar');
// Instantiate Virtual Attributes
foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
$strVirtualPrefix = $strAliasPrefix . '__';
$strVirtualPrefixLength = strlen($strVirtualPrefix);
if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
}
}
// Prepare to Check for Early/Virtual Binding
if (!$strAliasPrefix) {
$strAliasPrefix = 'role_module_authorization__';
}
// Check for RoleModule Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'role_module_id__role_module_id'))) {
$objToReturn->objRoleModule = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'role_module_id__', $strExpandAsArrayNodes);
}
// Check for Authorization Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'authorization_id__authorization_id'))) {
$objToReturn->objAuthorization = Authorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_id__', $strExpandAsArrayNodes);
}
// Check for AuthorizationLevel Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'authorization_level_id__authorization_level_id'))) {
$objToReturn->objAuthorizationLevel = AuthorizationLevel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_level_id__', $strExpandAsArrayNodes);
}
// Check for CreatedByObject Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'created_by__user_account_id'))) {
$objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes);
}
// Check for ModifiedByObject Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'modified_by__user_account_id'))) {
$objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes);
}
return $objToReturn;
}
示例11: InstantiateDbRow
/**
* Instantiate a AssetTransactionCheckout from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this AssetTransactionCheckout::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 AssetTransactionCheckout
*/
public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array())
{
// If blank row, return null
if (!$objDbRow) {
return null;
}
// Create a new instance of the AssetTransactionCheckout object
$objToReturn = new AssetTransactionCheckout();
$objToReturn->__blnRestored = true;
$strAliasName = array_key_exists($strAliasPrefix . 'asset_transaction_checkout_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_transaction_checkout_id'] : $strAliasPrefix . 'asset_transaction_checkout_id';
$objToReturn->intAssetTransactionCheckoutId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'asset_transaction_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_transaction_id'] : $strAliasPrefix . 'asset_transaction_id';
$objToReturn->intAssetTransactionId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'to_contact_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'to_contact_id'] : $strAliasPrefix . 'to_contact_id';
$objToReturn->intToContactId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'to_user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'to_user_id'] : $strAliasPrefix . 'to_user_id';
$objToReturn->intToUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'due_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'due_date'] : $strAliasPrefix . 'due_date';
$objToReturn->dttDueDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
$strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by';
$objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date';
$objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
$strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by';
$objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer');
$strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date';
$objToReturn->strModifiedDate = $objDbRow->GetColumn($strAliasName, 'VarChar');
// Instantiate Virtual Attributes
foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
$strVirtualPrefix = $strAliasPrefix . '__';
$strVirtualPrefixLength = strlen($strVirtualPrefix);
if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
}
}
// Prepare to Check for Early/Virtual Binding
if (!$strAliasPrefix) {
$strAliasPrefix = 'asset_transaction_checkout__';
}
// Check for AssetTransaction Early Binding
$strAlias = $strAliasPrefix . 'asset_transaction_id__asset_transaction_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objAssetTransaction = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'asset_transaction_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for ToContact Early Binding
$strAlias = $strAliasPrefix . 'to_contact_id__contact_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objToContact = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'to_contact_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for ToUser Early Binding
$strAlias = $strAliasPrefix . 'to_user_id__user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objToUser = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'to_user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for CreatedByObject Early Binding
$strAlias = $strAliasPrefix . 'created_by__user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
// Check for ModifiedByObject Early Binding
$strAlias = $strAliasPrefix . 'modified_by__user_account_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if (!is_null($objDbRow->GetColumn($strAliasName))) {
$objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
return $objToReturn;
}
示例12: InstantiateDbRow
/**
* Instantiate a Location from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Location::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Location
*/
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->intLocationId == $objDbRow->GetColumn($strAliasPrefix . 'location_id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'location__';
}
if (array_key_exists($strAliasPrefix . 'asset__asset_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'asset__asset_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetArray[$intPreviousChildItemCount - 1];
$objChildItem = Asset::InstantiateDbRow($objDbRow, $strAliasPrefix . 'asset__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetArray, Asset::InstantiateDbRow($objDbRow, $strAliasPrefix . 'asset__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'assettransactionassource__asset_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransactionassource__asset_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetTransactionAsSourceArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionAsSourceArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionassource__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetTransactionAsSourceArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetTransactionAsSourceArray, AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionassource__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'assettransactionasdestination__asset_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'assettransactionasdestination__asset_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAssetTransactionAsDestinationArray)) {
$objPreviousChildItem = $objPreviousItem->_objAssetTransactionAsDestinationArray[$intPreviousChildItemCount - 1];
$objChildItem = AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasdestination__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAssetTransactionAsDestinationArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAssetTransactionAsDestinationArray, AssetTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assettransactionasdestination__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'auditscan__audit_scan_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'auditscan__audit_scan_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objAuditScanArray)) {
$objPreviousChildItem = $objPreviousItem->_objAuditScanArray[$intPreviousChildItemCount - 1];
$objChildItem = AuditScan::InstantiateDbRow($objDbRow, $strAliasPrefix . 'auditscan__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objAuditScanArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objAuditScanArray, AuditScan::InstantiateDbRow($objDbRow, $strAliasPrefix . 'auditscan__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'inventorylocation__inventory_location_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorylocation__inventory_location_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objInventoryLocationArray)) {
$objPreviousChildItem = $objPreviousItem->_objInventoryLocationArray[$intPreviousChildItemCount - 1];
$objChildItem = InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objInventoryLocationArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objInventoryLocationArray, InventoryLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorylocation__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'inventorytransactionassource__inventory_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorytransactionassource__inventory_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objInventoryTransactionAsSourceArray)) {
$objPreviousChildItem = $objPreviousItem->_objInventoryTransactionAsSourceArray[$intPreviousChildItemCount - 1];
$objChildItem = InventoryTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorytransactionassource__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objInventoryTransactionAsSourceArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objInventoryTransactionAsSourceArray, InventoryTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorytransactionassource__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'inventorytransactionasdestination__inventory_transaction_id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'inventorytransactionasdestination__inventory_transaction_id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objInventoryTransactionAsDestinationArray)) {
$objPreviousChildItem = $objPreviousItem->_objInventoryTransactionAsDestinationArray[$intPreviousChildItemCount - 1];
$objChildItem = InventoryTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorytransactionasdestination__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objInventoryTransactionAsDestinationArray, $objChildItem);
//.........这里部分代码省略.........
示例13: InstantiateCursor
/**
* Instantiate a single UserAccount 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 UserAccount 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 UserAccount::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
示例14: InstantiateDbResult
/**
* Instantiate an array of UserAccounts from a Database Result
* @param DatabaseResultBase $objDbResult
* @return UserAccount[]
*/
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 = UserAccount::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem);
if ($objItem) {
array_push($objToReturn, $objItem);
$objLastRowItem = $objItem;
}
}
} else {
while ($objDbRow = $objDbResult->GetNextRow()) {
array_push($objToReturn, UserAccount::InstantiateDbRow($objDbRow));
}
}
return $objToReturn;
}
示例15: InstantiateDbRow
/**
* Instantiate a Company from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Company::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 Company
*/
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 . 'company_id';
$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intCompanyId == $objDbRow->GetColumn($strAliasName, 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'company__';
}
$strAlias = $strAliasPrefix . 'address__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 . 'contact__contact_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->_objContactArray)) {
$objPreviousChildItem = $objPreviousItem->_objContactArray[$intPreviousChildItemCount - 1];
$objChildItem = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objContactArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objContactArray[] = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'receiptasfrom__receipt_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->_objReceiptAsFromArray)) {
$objPreviousChildItem = $objPreviousItem->_objReceiptAsFromArray[$intPreviousChildItemCount - 1];
$objChildItem = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objReceiptAsFromArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objReceiptAsFromArray[] = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'shipmentasfrom__shipment_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->_objShipmentAsFromArray)) {
$objPreviousChildItem = $objPreviousItem->_objShipmentAsFromArray[$intPreviousChildItemCount - 1];
$objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objShipmentAsFromArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objShipmentAsFromArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
}
$blnExpandedViaArray = true;
}
$strAlias = $strAliasPrefix . 'shipmentasto__shipment_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->_objShipmentAsToArray)) {
$objPreviousChildItem = $objPreviousItem->_objShipmentAsToArray[$intPreviousChildItemCount - 1];
$objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
if ($objChildItem) {
$objPreviousItem->_objShipmentAsToArray[] = $objChildItem;
}
} else {
$objPreviousItem->_objShipmentAsToArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $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;
//.........这里部分代码省略.........