Exemplo n.º 1
0
 /**
  * Instantiate a ClassGroup from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this ClassGroup::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return ClassGroup
  */
 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 = 'class_group__';
         }
         if (array_key_exists($strAliasPrefix . 'qcodoclass__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoclass__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoClassArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoClassArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoClassArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'qcodointerface__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodointerface__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoInterfaceArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoInterfaceArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoInterfaceArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoInterfaceArray, QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $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 == 'class_group__') {
                 $strAliasPrefix = null;
             }
         }
     }
     // Create a new instance of the ClassGroup object
     $objToReturn = new ClassGroup();
     $objToReturn->__blnRestored = true;
     $objToReturn->intId = $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer');
     $objToReturn->strName = $objDbRow->GetColumn($strAliasPrefix . 'name', 'VarChar');
     $objToReturn->intOrderNumber = $objDbRow->GetColumn($strAliasPrefix . 'order_number', '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 = 'class_group__';
     }
     // Check for QcodoClass Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoclass__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodoclass__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoClass = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes);
         }
     }
     // Check for QcodoInterface Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodointerface__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodointerface__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoInterfaceArray, QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoInterface = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes);
         }
     }
     return $objToReturn;
 }
Exemplo n.º 2
0
 /**
  * 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);
         }
     }
     return $objToReturn;
 }
Exemplo n.º 3
0
 /**
  * Instantiate a QcodoClass from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this QcodoClass::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return QcodoClass
  */
 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 = 'qcodo_class__';
         }
         if (array_key_exists($strAliasPrefix . 'classproperty__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'classproperty__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objClassPropertyArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objClassPropertyArray[$intPreviousChildItemCount - 1];
                 $objChildItem = ClassProperty::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classproperty__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objClassPropertyArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objClassPropertyArray, ClassProperty::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classproperty__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'classvariable__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'classvariable__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objClassVariableArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objClassVariableArray[$intPreviousChildItemCount - 1];
                 $objChildItem = ClassVariable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classvariable__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objClassVariableArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objClassVariableArray, ClassVariable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classvariable__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'operation__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'operation__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objOperationArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objOperationArray[$intPreviousChildItemCount - 1];
                 $objChildItem = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objOperationArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objOperationArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'childqcodoclass__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'childqcodoclass__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objChildQcodoClassArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objChildQcodoClassArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childqcodoclass__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objChildQcodoClassArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objChildQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childqcodoclass__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'qcodoconstant__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoconstant__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoConstantArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoConstantArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoConstantArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoConstantArray, QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'variableasobjecttype__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'variableasobjecttype__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objVariableAsObjectTypeArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objVariableAsObjectTypeArray[$intPreviousChildItemCount - 1];
                 $objChildItem = Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'variableasobjecttype__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objVariableAsObjectTypeArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objVariableAsObjectTypeArray, Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'variableasobjecttype__', $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 == 'qcodo_class__') {
                 $strAliasPrefix = null;
             }
         }
     }
     // Create a new instance of the QcodoClass object
     $objToReturn = new QcodoClass();
     $objToReturn->__blnRestored = true;
     $objToReturn->intId = $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer');
     $objToReturn->intParentQcodoClassId = $objDbRow->GetColumn($strAliasPrefix . 'parent_qcodo_class_id', 'Integer');
     $objToReturn->intInterfaceId = $objDbRow->GetColumn($strAliasPrefix . 'interface_id', 'Integer');
     $objToReturn->intClassGroupId = $objDbRow->GetColumn($strAliasPrefix . 'class_group_id', 'Integer');
     $objToReturn->strName = $objDbRow->GetColumn($strAliasPrefix . 'name', 'VarChar');
     $objToReturn->blnAbstractFlag = $objDbRow->GetColumn($strAliasPrefix . 'abstract_flag', 'Bit');
     $objToReturn->blnEnumerationFlag = $objDbRow->GetColumn($strAliasPrefix . 'enumeration_flag', 'Bit');
     $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 = 'qcodo_class__';
     }
     // Check for ParentQcodoClass Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'parent_qcodo_class_id__id'))) {
         $objToReturn->objParentQcodoClass = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_qcodo_class_id__', $strExpandAsArrayNodes);
     }
     // Check for Interface Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'interface_id__id'))) {
         $objToReturn->objInterface = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'interface_id__', $strExpandAsArrayNodes);
     }
     // Check for ClassGroup Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'class_group_id__id'))) {
         $objToReturn->objClassGroup = ClassGroup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_group_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 ClassProperty Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'classproperty__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'classproperty__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objClassPropertyArray, ClassProperty::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classproperty__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objClassProperty = ClassProperty::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classproperty__', $strExpandAsArrayNodes);
         }
     }
     // Check for ClassVariable Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'classvariable__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'classvariable__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objClassVariableArray, ClassVariable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classvariable__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objClassVariable = ClassVariable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classvariable__', $strExpandAsArrayNodes);
         }
     }
     // Check for Operation Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'operation__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'operation__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objOperationArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objOperation = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes);
         }
     }
     // Check for ChildQcodoClass Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'childqcodoclass__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'childqcodoclass__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objChildQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childqcodoclass__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objChildQcodoClass = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'childqcodoclass__', $strExpandAsArrayNodes);
         }
     }
     // Check for QcodoConstant Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoconstant__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodoconstant__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoConstantArray, QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoConstant = QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes);
         }
     }
     // Check for VariableAsObjectType Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'variableasobjecttype__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'variableasobjecttype__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objVariableAsObjectTypeArray, Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'variableasobjecttype__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objVariableAsObjectType = Variable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'variableasobjecttype__', $strExpandAsArrayNodes);
         }
     }
     return $objToReturn;
 }
Exemplo n.º 4
0
 /**
  * Instantiate an array of QcodoInterfaces from a Database Result
  * @param DatabaseResultBase $objDbResult
  * @return QcodoInterface[]
  */
 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 = QcodoInterface::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem);
             if ($objItem) {
                 array_push($objToReturn, $objItem);
                 $objLastRowItem = $objItem;
             }
         }
     } else {
         while ($objDbRow = $objDbResult->GetNextRow()) {
             array_push($objToReturn, QcodoInterface::InstantiateDbRow($objDbRow));
         }
     }
     return $objToReturn;
 }
Exemplo n.º 5
0
 /**
  * Instantiate a File from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this File::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @return File
  */
 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 = 'file__';
         }
         if (array_key_exists($strAliasPrefix . 'operation__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'operation__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objOperationArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objOperationArray[$intPreviousChildItemCount - 1];
                 $objChildItem = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objOperationArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objOperationArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'qcodoclass__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoclass__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoClassArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoClassArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoClassArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'qcodoconstant__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoconstant__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoConstantArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoConstantArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoConstantArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoConstantArray, QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes));
             }
             $blnExpandedViaArray = true;
         }
         if (array_key_exists($strAliasPrefix . 'qcodointerface__id', $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodointerface__id'))) {
             if ($intPreviousChildItemCount = count($objPreviousItem->_objQcodoInterfaceArray)) {
                 $objPreviousChildItem = $objPreviousItem->_objQcodoInterfaceArray[$intPreviousChildItemCount - 1];
                 $objChildItem = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes, $objPreviousChildItem);
                 if ($objChildItem) {
                     array_push($objPreviousItem->_objQcodoInterfaceArray, $objChildItem);
                 }
             } else {
                 array_push($objPreviousItem->_objQcodoInterfaceArray, QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $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 == 'file__') {
                 $strAliasPrefix = null;
             }
         }
     }
     // Create a new instance of the File object
     $objToReturn = new File();
     $objToReturn->__blnRestored = true;
     $objToReturn->intId = $objDbRow->GetColumn($strAliasPrefix . 'id', 'Integer');
     $objToReturn->intDirectoryId = $objDbRow->GetColumn($strAliasPrefix . 'directory_id', 'Integer');
     $objToReturn->strPath = $objDbRow->GetColumn($strAliasPrefix . 'path', 'VarChar');
     $objToReturn->intDeprecatedMajorVersion = $objDbRow->GetColumn($strAliasPrefix . 'deprecated_major_version', 'Integer');
     $objToReturn->intDeprecatedMinorVersion = $objDbRow->GetColumn($strAliasPrefix . 'deprecated_minor_version', 'Integer');
     $objToReturn->intDeprecatedBuild = $objDbRow->GetColumn($strAliasPrefix . 'deprecated_build', '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 = 'file__';
     }
     // Check for Directory Early Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'directory_id__id'))) {
         $objToReturn->objDirectory = DirectoryToken::InstantiateDbRow($objDbRow, $strAliasPrefix . 'directory_id__', $strExpandAsArrayNodes);
     }
     // Check for Operation Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'operation__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'operation__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objOperationArray, Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objOperation = Operation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'operation__', $strExpandAsArrayNodes);
         }
     }
     // Check for QcodoClass Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoclass__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodoclass__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoClassArray, QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoClass = QcodoClass::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoclass__', $strExpandAsArrayNodes);
         }
     }
     // Check for QcodoConstant Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodoconstant__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodoconstant__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoConstantArray, QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoConstant = QcodoConstant::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodoconstant__', $strExpandAsArrayNodes);
         }
     }
     // Check for QcodoInterface Virtual Binding
     if (!is_null($objDbRow->GetColumn($strAliasPrefix . 'qcodointerface__id'))) {
         if ($strExpandAsArrayNodes && array_key_exists($strAliasPrefix . 'qcodointerface__id', $strExpandAsArrayNodes)) {
             array_push($objToReturn->_objQcodoInterfaceArray, QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes));
         } else {
             $objToReturn->_objQcodoInterface = QcodoInterface::InstantiateDbRow($objDbRow, $strAliasPrefix . 'qcodointerface__', $strExpandAsArrayNodes);
         }
     }
     return $objToReturn;
 }