本文整理汇总了PHP中Parameter::InstantiateDbRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::InstantiateDbRow方法的具体用法?PHP Parameter::InstantiateDbRow怎么用?PHP Parameter::InstantiateDbRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::InstantiateDbRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstantiateDbRow
/**
* Instantiate a Variable from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Variable::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Variable
*/
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->intId == $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'variable__';
}
if (array_key_exists($strAliasPrefix . 'operationasreturn__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'operationasreturn__id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objOperationAsReturnArray)) {
$objPreviousChildItem = $objPreviousItem->_objOperationAsReturnArray[$intPreviousChildItemCount - 1];
$objChildItem = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operationasreturn__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objOperationAsReturnArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objOperationAsReturnArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operationasreturn__', $strExpandAsArrayNodes));
}
$blnExpandedViaArray = true;
}
if (array_key_exists($strAliasPrefix . 'operationasadditional__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'operationasadditional__id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objOperationAsAdditionalArray)) {
$objPreviousChildItem = $objPreviousItem->_objOperationAsAdditionalArray[$intPreviousChildItemCount - 1];
$objChildItem = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operationasadditional__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objOperationAsAdditionalArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objOperationAsAdditionalArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operationasadditional__', $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 == 'variable__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Variable object
$objToReturn = new Variable();
$objToReturn->__blnRestored = true;
$objToReturn->intId = $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer');
$objToReturn->strName = $objDbRow->GetColumn($strAliasPrefix . 'name', 'VarChar');
$objToReturn->intVariableTypeId = $objDbRow->GetColumn($strAliasPrefix . 'variable_type_id', 'Integer');
$objToReturn->intObjectTypeId = $objDbRow->GetColumn($strAliasPrefix . 'object_type_id', 'Integer');
$objToReturn->blnArrayFlag = $objDbRow->GetColumn($strAliasPrefix . 'array_flag', 'Bit');
$objToReturn->strDefaultValue = $objDbRow->GetColumn($strAliasPrefix . 'default_value', 'VarChar');
$objToReturn->strFirstVersion = $objDbRow->GetColumn($strAliasPrefix . 'first_version', 'VarChar');
$objToReturn->strLastVersion = $objDbRow->GetColumn($strAliasPrefix . 'last_version', 'VarChar');
$objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'Blob');
$objToReturn->strExtendedDescription = $objDbRow->GetColumn($strAliasPrefix . 'extended_description', 'Blob');
// 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 = 'variable__';
}
// Check for ObjectType Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'object_type_id__id'))) {
$objToReturn->objObjectType = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'object_type_id__', $strExpandAsArrayNodes);
}
// Check for ClassProperty Unique ReverseReference Binding
if ($objDbRow->ColumnExists($strAliasPrefix . 'classproperty__id')) {
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'classproperty__id'))) {
$objToReturn->objClassProperty = ClassProperty::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classproperty__', $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->objClassProperty = false;
}
}
// Check for ClassVariable Unique ReverseReference Binding
if ($objDbRow->ColumnExists($strAliasPrefix . 'classvariable__id')) {
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'classvariable__id'))) {
$objToReturn->objClassVariable = ClassVariable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classvariable__', $strExpandAsArrayNodes);
} else {
// We ATTEMPTED to do an Early Bind but the Object Doesn't Exist
//.........这里部分代码省略.........
示例2: InstantiateDbResult
/**
* Instantiate an array of Parameters from a Database Result
* @param DatabaseResultBase $objDbResult
* @return Parameter[]
*/
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 = Parameter::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem);
if ($objItem) {
array_push($objToReturn, $objItem);
$objLastRowItem = $objItem;
}
}
} else {
while ($objDbRow = $objDbResult->GetNextRow()) {
array_push($objToReturn, Parameter::InstantiateDbRow($objDbRow));
}
}
return $objToReturn;
}
示例3: InstantiateDbRow
/**
* Instantiate a Operation from a Database Row.
* Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
* is calling this Operation::InstantiateDbRow in order to perform
* early binding on referenced objects.
* @param DatabaseRowBase $objDbRow
* @param string $strAliasPrefix
* @return Operation
*/
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->intId == $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer')) {
// We are. Now, prepare to check for ExpandAsArray clauses
$blnExpandedViaArray = false;
if (!$strAliasPrefix) {
$strAliasPrefix = 'operation__';
}
if (array_key_exists($strAliasPrefix . 'parameter__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'parameter__id'))) {
if ($intPreviousChildItemCount = count($objPreviousItem->_objParameterArray)) {
$objPreviousChildItem = $objPreviousItem->_objParameterArray[$intPreviousChildItemCount - 1];
$objChildItem = Parameter::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parameter__', $strExpandAsArrayNodes, $objPreviousChildItem);
if ($objChildItem) {
array_push($objPreviousItem->_objParameterArray, $objChildItem);
}
} else {
array_push($objPreviousItem->_objParameterArray, Parameter::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parameter__', $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 == 'operation__') {
$strAliasPrefix = null;
}
}
}
// Create a new instance of the Operation object
$objToReturn = new Operation();
$objToReturn->__blnRestored = true;
$objToReturn->intId = $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer');
$objToReturn->intQcodoClassId = $objDbRow->GetColumn($strAliasPrefix . 'qcodo_class_id', 'Integer');
$objToReturn->intQcodoInterfaceId = $objDbRow->GetColumn($strAliasPrefix . 'qcodo_interface_id', 'Integer');
$objToReturn->strName = $objDbRow->GetColumn($strAliasPrefix . 'name', 'VarChar');
$objToReturn->intProtectionTypeId = $objDbRow->GetColumn($strAliasPrefix . 'protection_type_id', 'Integer');
$objToReturn->blnStaticFlag = $objDbRow->GetColumn($strAliasPrefix . 'static_flag', 'Bit');
$objToReturn->blnAbstractFlag = $objDbRow->GetColumn($strAliasPrefix . 'abstract_flag', 'Bit');
$objToReturn->blnFinalFlag = $objDbRow->GetColumn($strAliasPrefix . 'final_flag', 'Bit');
$objToReturn->intReturnVariableId = $objDbRow->GetColumn($strAliasPrefix . 'return_variable_id', 'Integer');
$objToReturn->intAdditionalVariableId = $objDbRow->GetColumn($strAliasPrefix . 'additional_variable_id', 'Integer');
$objToReturn->strFirstVersion = $objDbRow->GetColumn($strAliasPrefix . 'first_version', 'VarChar');
$objToReturn->strLastVersion = $objDbRow->GetColumn($strAliasPrefix . 'last_version', 'VarChar');
$objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasPrefix . 'short_description', 'Blob');
$objToReturn->strExtendedDescription = $objDbRow->GetColumn($strAliasPrefix . 'extended_description', 'Blob');
$objToReturn->intFileId = $objDbRow->GetColumn($strAliasPrefix . 'file_id', '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 = 'operation__';
}
// Check for QcodoClass Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodo_class_id__id'))) {
$objToReturn->objQcodoClass = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodo_class_id__', $strExpandAsArrayNodes);
}
// Check for QcodoInterface Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodo_interface_id__id'))) {
$objToReturn->objQcodoInterface = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodo_interface_id__', $strExpandAsArrayNodes);
}
// Check for ReturnVariable Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'return_variable_id__id'))) {
$objToReturn->objReturnVariable = Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'return_variable_id__', $strExpandAsArrayNodes);
}
// Check for AdditionalVariable Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'additional_variable_id__id'))) {
$objToReturn->objAdditionalVariable = Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'additional_variable_id__', $strExpandAsArrayNodes);
}
// Check for File Early Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'file_id__id'))) {
$objToReturn->objFile = File::InstantiateDbRow($objDbRow, $strAliasPrefix . 'file_id__', $strExpandAsArrayNodes);
}
// Check for Parameter Virtual Binding
if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'parameter__id'))) {
if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'parameter__id', $strExpandAsArrayNodes)) {
array_push($objToReturn->_objParameterArray, Parameter::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parameter__', $strExpandAsArrayNodes));
} else {
$objToReturn->_objParameter = Parameter::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parameter__', $strExpandAsArrayNodes);
}
//.........这里部分代码省略.........