当前位置: 首页>>代码示例>>PHP>>正文


PHP Parameter::InstantiateDbRow方法代码示例

本文整理汇总了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
//.........这里部分代码省略.........
开发者ID:qcodo,项目名称:qcodo-api,代码行数:101,代码来源:VariableGen.class.php

示例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;
 }
开发者ID:qcodo,项目名称:qcodo-api,代码行数:29,代码来源:ParameterGen.class.php

示例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);
         }
//.........这里部分代码省略.........
开发者ID:qcodo,项目名称:qcodo-api,代码行数:101,代码来源:OperationGen.class.php


注:本文中的Parameter::InstantiateDbRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。