/**
  * Instantiate a NarroSuggestionVote from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this NarroSuggestionVote::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $arrPreviousItem
  * @param string[] $strColumnAliasArray
  * @return NarroSuggestionVote
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array())
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the NarroSuggestionVote object
     $objToReturn = new NarroSuggestionVote();
     $objToReturn->__blnRestored = true;
     $strAlias = $strAliasPrefix . 'suggestion_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intSuggestionId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $objToReturn->__intSuggestionId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'context_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intContextId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $objToReturn->__intContextId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $objToReturn->__intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'vote_value';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intVoteValue = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'created';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->dttCreated = $objDbRow->GetColumn($strAliasName, 'DateTime');
     $strAlias = $strAliasPrefix . 'modified';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->dttModified = $objDbRow->GetColumn($strAliasName, 'DateTime');
     if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
         foreach ($arrPreviousItems as $objPreviousItem) {
             if ($objToReturn->SuggestionId != $objPreviousItem->SuggestionId) {
                 continue;
             }
             if ($objToReturn->ContextId != $objPreviousItem->ContextId) {
                 continue;
             }
             if ($objToReturn->UserId != $objPreviousItem->UserId) {
                 continue;
             }
             // complete match - all primary key columns are the same
             return null;
         }
     }
     // Instantiate Virtual Attributes
     $strVirtualPrefix = $strAliasPrefix . '__';
     $strVirtualPrefixLength = strlen($strVirtualPrefix);
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         if (strncmp($strColumnName, $strVirtualPrefix, $strVirtualPrefixLength) == 0) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'narro_suggestion_vote__';
     }
     // Check for Suggestion Early Binding
     $strAlias = $strAliasPrefix . 'suggestion_id__suggestion_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objSuggestion = NarroSuggestion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'suggestion_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Context Early Binding
     $strAlias = $strAliasPrefix . 'context_id__context_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objContext = NarroContext::InstantiateDbRow($objDbRow, $strAliasPrefix . 'context_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for User Early Binding
     $strAlias = $strAliasPrefix . 'user_id__user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objUser = NarroUser::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     return $objToReturn;
 }
 /**
  * Instantiate a NarroSuggestion from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this NarroSuggestion::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $arrPreviousItem
  * @param string[] $strColumnAliasArray
  * @return NarroSuggestion
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = 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 . 'suggestion_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if ($strExpandAsArrayNodes && is_array($arrPreviousItems) && count($arrPreviousItems)) {
         foreach ($arrPreviousItems as $objPreviousItem) {
             if ($objPreviousItem->intSuggestionId == $objDbRow->GetColumn($strAliasName, 'Integer')) {
                 // We are.  Now, prepare to check for ExpandAsArray clauses
                 $blnExpandedViaArray = false;
                 if (!$strAliasPrefix) {
                     $strAliasPrefix = 'narro_suggestion__';
                 }
                 // Expanding reverse references: NarroContextInfoAsValidSuggestion
                 $strAlias = $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__context_info_id';
                 $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
                 if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) {
                     if (null === $objPreviousItem->_objNarroContextInfoAsValidSuggestionArray) {
                         $objPreviousItem->_objNarroContextInfoAsValidSuggestionArray = array();
                     }
                     if ($intPreviousChildItemCount = count($objPreviousItem->_objNarroContextInfoAsValidSuggestionArray)) {
                         $objPreviousChildItems = $objPreviousItem->_objNarroContextInfoAsValidSuggestionArray;
                         $objChildItem = NarroContextInfo::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
                         if ($objChildItem) {
                             $objPreviousItem->_objNarroContextInfoAsValidSuggestionArray[] = $objChildItem;
                         }
                     } else {
                         $objPreviousItem->_objNarroContextInfoAsValidSuggestionArray[] = NarroContextInfo::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
                     }
                     $blnExpandedViaArray = true;
                 }
                 // Expanding reverse references: NarroSuggestionVoteAsSuggestion
                 $strAlias = $strAliasPrefix . 'narrosuggestionvoteassuggestion__suggestion_id';
                 $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
                 if (array_key_exists($strAlias, $strExpandAsArrayNodes) && !is_null($objDbRow->GetColumn($strAliasName))) {
                     if (null === $objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray) {
                         $objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray = array();
                     }
                     if ($intPreviousChildItemCount = count($objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray)) {
                         $objPreviousChildItems = $objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray;
                         $objChildItem = NarroSuggestionVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrosuggestionvoteassuggestion__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
                         if ($objChildItem) {
                             $objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray[] = $objChildItem;
                         }
                     } else {
                         $objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray[] = NarroSuggestionVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrosuggestionvoteassuggestion__', $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 == 'narro_suggestion__') {
                         $strAliasPrefix = null;
                     }
                 }
             }
         }
     }
     // Create a new instance of the NarroSuggestion object
     $objToReturn = new NarroSuggestion();
     $objToReturn->__blnRestored = true;
     $strAlias = $strAliasPrefix . 'suggestion_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intSuggestionId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'text_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intTextId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'language_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intLanguageId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'suggestion_value';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->strSuggestionValue = $objDbRow->GetColumn($strAliasName, 'Blob');
     $strAlias = $strAliasPrefix . 'suggestion_value_md5';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->strSuggestionValueMd5 = $objDbRow->GetColumn($strAliasName, 'VarChar');
     $strAlias = $strAliasPrefix . 'suggestion_char_count';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intSuggestionCharCount = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'suggestion_word_count';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intSuggestionWordCount = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'has_comments';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->blnHasComments = $objDbRow->GetColumn($strAliasName, 'Bit');
     $strAlias = $strAliasPrefix . 'is_imported';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->blnIsImported = $objDbRow->GetColumn($strAliasName, 'Bit');
     $strAlias = $strAliasPrefix . 'created';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->dttCreated = $objDbRow->GetColumn($strAliasName, 'DateTime');
     $strAlias = $strAliasPrefix . 'modified';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->dttModified = $objDbRow->GetColumn($strAliasName, 'DateTime');
     if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
         foreach ($arrPreviousItems as $objPreviousItem) {
             if ($objToReturn->SuggestionId != $objPreviousItem->SuggestionId) {
                 continue;
             }
             $prevCnt = count($objPreviousItem->_objNarroContextInfoAsValidSuggestionArray);
             $cnt = count($objToReturn->_objNarroContextInfoAsValidSuggestionArray);
             if ($prevCnt != $cnt) {
                 continue;
             }
             if ($prevCnt == 0 || $cnt == 0 || !array_diff($objPreviousItem->_objNarroContextInfoAsValidSuggestionArray, $objToReturn->_objNarroContextInfoAsValidSuggestionArray)) {
                 continue;
             }
             $prevCnt = count($objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray);
             $cnt = count($objToReturn->_objNarroSuggestionVoteAsSuggestionArray);
             if ($prevCnt != $cnt) {
                 continue;
             }
             if ($prevCnt == 0 || $cnt == 0 || !array_diff($objPreviousItem->_objNarroSuggestionVoteAsSuggestionArray, $objToReturn->_objNarroSuggestionVoteAsSuggestionArray)) {
                 continue;
             }
             // complete match - all primary key columns are the same
             return null;
         }
     }
     // Instantiate Virtual Attributes
     $strVirtualPrefix = $strAliasPrefix . '__';
     $strVirtualPrefixLength = strlen($strVirtualPrefix);
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         if (strncmp($strColumnName, $strVirtualPrefix, $strVirtualPrefixLength) == 0) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'narro_suggestion__';
     }
     // Check for User Early Binding
     $strAlias = $strAliasPrefix . 'user_id__user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objUser = NarroUser::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Text Early Binding
     $strAlias = $strAliasPrefix . 'text_id__text_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objText = NarroText::InstantiateDbRow($objDbRow, $strAliasPrefix . 'text_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Language Early Binding
     $strAlias = $strAliasPrefix . 'language_id__language_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objLanguage = NarroLanguage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'language_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for NarroContextInfoAsValidSuggestion Virtual Binding
     $strAlias = $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__context_info_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $blnExpanded = $strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes);
     if ($blnExpanded && null === $objToReturn->_objNarroContextInfoAsValidSuggestionArray) {
         $objToReturn->_objNarroContextInfoAsValidSuggestionArray = array();
     }
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         if ($blnExpanded) {
             $objToReturn->_objNarroContextInfoAsValidSuggestionArray[] = NarroContextInfo::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
             $objToReturn->_objNarroContextInfoAsValidSuggestion = NarroContextInfo::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrocontextinfoasvalidsuggestion__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         }
     }
     // Check for NarroSuggestionVoteAsSuggestion Virtual Binding
     $strAlias = $strAliasPrefix . 'narrosuggestionvoteassuggestion__suggestion_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $blnExpanded = $strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes);
     if ($blnExpanded && null === $objToReturn->_objNarroSuggestionVoteAsSuggestionArray) {
         $objToReturn->_objNarroSuggestionVoteAsSuggestionArray = array();
     }
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         if ($blnExpanded) {
             $objToReturn->_objNarroSuggestionVoteAsSuggestionArray[] = NarroSuggestionVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrosuggestionvoteassuggestion__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
             $objToReturn->_objNarroSuggestionVoteAsSuggestion = NarroSuggestionVote::InstantiateDbRow($objDbRow, $strAliasPrefix . 'narrosuggestionvoteassuggestion__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         }
     }
     return $objToReturn;
 }
Exemple #3
0
 /**
  * Instantiate a NarroLog from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this NarroLog::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param DatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $arrPreviousItem
  * @param string[] $strColumnAliasArray
  * @return NarroLog
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array())
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the NarroLog object
     $objToReturn = new NarroLog();
     $objToReturn->__blnRestored = true;
     $strAlias = $strAliasPrefix . 'log_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intLogId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'language_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intLanguageId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'project_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'message';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->strMessage = $objDbRow->GetColumn($strAliasName, 'Blob');
     $strAlias = $strAliasPrefix . 'priority';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->intPriority = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAlias = $strAliasPrefix . 'date';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     $objToReturn->dttDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
     if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
         foreach ($arrPreviousItems as $objPreviousItem) {
             if ($objToReturn->LogId != $objPreviousItem->LogId) {
                 continue;
             }
             // complete match - all primary key columns are the same
             return null;
         }
     }
     // Instantiate Virtual Attributes
     $strVirtualPrefix = $strAliasPrefix . '__';
     $strVirtualPrefixLength = strlen($strVirtualPrefix);
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         if (strncmp($strColumnName, $strVirtualPrefix, $strVirtualPrefixLength) == 0) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'narro_log__';
     }
     // Check for Language Early Binding
     $strAlias = $strAliasPrefix . 'language_id__language_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objLanguage = NarroLanguage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'language_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for Project Early Binding
     $strAlias = $strAliasPrefix . 'project_id__project_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objProject = NarroProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'project_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for User Early Binding
     $strAlias = $strAliasPrefix . 'user_id__user_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objUser = NarroUser::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     return $objToReturn;
 }
Exemple #4
0
 /**
  * Instantiate a single NarroUser 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 NarroUser 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 NarroUser::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray);
 }