/** * Instantiate a Login from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Login::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 Login */ 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 . 'id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'login__'; } $strAlias = $strAliasPrefix . 'ministry__ministry_id__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->_objMinistryArray)) { $objPreviousChildItem = $objPreviousItem->_objMinistryArray[$intPreviousChildItemCount - 1]; $objChildItem = Ministry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'ministry__ministry_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objMinistryArray[] = $objChildItem; } } else { $objPreviousItem->_objMinistryArray[] = Ministry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'ministry__ministry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'commentaspostedby__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->_objCommentAsPostedByArray)) { $objPreviousChildItem = $objPreviousItem->_objCommentAsPostedByArray[$intPreviousChildItemCount - 1]; $objChildItem = Comment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'commentaspostedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objCommentAsPostedByArray[] = $objChildItem; } } else { $objPreviousItem->_objCommentAsPostedByArray[] = Comment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'commentaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'emailmessageroute__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->_objEmailMessageRouteArray)) { $objPreviousChildItem = $objPreviousItem->_objEmailMessageRouteArray[$intPreviousChildItemCount - 1]; $objChildItem = EmailMessageRoute::InstantiateDbRow($objDbRow, $strAliasPrefix . 'emailmessageroute__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objEmailMessageRouteArray[] = $objChildItem; } } else { $objPreviousItem->_objEmailMessageRouteArray[] = EmailMessageRoute::InstantiateDbRow($objDbRow, $strAliasPrefix . 'emailmessageroute__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'smsmessage__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->_objSmsMessageArray)) { $objPreviousChildItem = $objPreviousItem->_objSmsMessageArray[$intPreviousChildItemCount - 1]; $objChildItem = SmsMessage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'smsmessage__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objSmsMessageArray[] = $objChildItem; } } else { $objPreviousItem->_objSmsMessageArray[] = SmsMessage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'smsmessage__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshipbatchascreatedby__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->_objStewardshipBatchAsCreatedByArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipBatchAsCreatedByArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipBatch::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipbatchascreatedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipBatchAsCreatedByArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipBatchAsCreatedByArray[] = StewardshipBatch::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipbatchascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshipcontributionascreatedby__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->_objStewardshipContributionAsCreatedByArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipContributionAsCreatedByArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionascreatedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipContributionAsCreatedByArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipContributionAsCreatedByArray[] = StewardshipContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshippostascreatedby__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->_objStewardshipPostAsCreatedByArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipPostAsCreatedByArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostascreatedby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipPostAsCreatedByArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipPostAsCreatedByArray[] = StewardshipPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostascreatedby__', $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 == 'login__') { $strAliasPrefix = null; } } } // Create a new instance of the Login object $objToReturn = new Login(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id'; $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'role_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_type_id'] : $strAliasPrefix . 'role_type_id'; $objToReturn->intRoleTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'permission_bitmap', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'permission_bitmap'] : $strAliasPrefix . 'permission_bitmap'; $objToReturn->intPermissionBitmap = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'username', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'username'] : $strAliasPrefix . 'username'; $objToReturn->strUsername = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'password_cache', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'password_cache'] : $strAliasPrefix . 'password_cache'; $objToReturn->strPasswordCache = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'password_last_set', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'password_last_set'] : $strAliasPrefix . 'password_last_set'; $objToReturn->strPasswordLastSet = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'date_last_login', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_last_login'] : $strAliasPrefix . 'date_last_login'; $objToReturn->dttDateLastLogin = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'domain_active_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'domain_active_flag'] : $strAliasPrefix . 'domain_active_flag'; $objToReturn->blnDomainActiveFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'login_active_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'login_active_flag'] : $strAliasPrefix . 'login_active_flag'; $objToReturn->blnLoginActiveFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'email', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email'] : $strAliasPrefix . 'email'; $objToReturn->strEmail = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'first_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'first_name'] : $strAliasPrefix . 'first_name'; $objToReturn->strFirstName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'middle_initial', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'middle_initial'] : $strAliasPrefix . 'middle_initial'; $objToReturn->strMiddleInitial = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'last_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'last_name'] : $strAliasPrefix . 'last_name'; $objToReturn->strLastName = $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 = 'login__'; } // Check for ClassInstructor Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'classinstructor__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassInstructor = ClassInstructor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classinstructor__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } 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->objClassInstructor = false; } } // Check for Ministry Virtual Binding $strAlias = $strAliasPrefix . 'ministry__ministry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objMinistryArray[] = Ministry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'ministry__ministry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objMinistry = Ministry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'ministry__ministry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for CommentAsPostedBy Virtual Binding $strAlias = $strAliasPrefix . 'commentaspostedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objCommentAsPostedByArray[] = Comment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'commentaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objCommentAsPostedBy = Comment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'commentaspostedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for EmailMessageRoute Virtual Binding $strAlias = $strAliasPrefix . 'emailmessageroute__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objEmailMessageRouteArray[] = EmailMessageRoute::InstantiateDbRow($objDbRow, $strAliasPrefix . 'emailmessageroute__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objEmailMessageRoute = EmailMessageRoute::InstantiateDbRow($objDbRow, $strAliasPrefix . 'emailmessageroute__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for SmsMessage Virtual Binding $strAlias = $strAliasPrefix . 'smsmessage__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objSmsMessageArray[] = SmsMessage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'smsmessage__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objSmsMessage = SmsMessage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'smsmessage__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipBatchAsCreatedBy Virtual Binding $strAlias = $strAliasPrefix . 'stewardshipbatchascreatedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipBatchAsCreatedByArray[] = StewardshipBatch::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipbatchascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipBatchAsCreatedBy = StewardshipBatch::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipbatchascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipContributionAsCreatedBy Virtual Binding $strAlias = $strAliasPrefix . 'stewardshipcontributionascreatedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipContributionAsCreatedByArray[] = StewardshipContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipContributionAsCreatedBy = StewardshipContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipPostAsCreatedBy Virtual Binding $strAlias = $strAliasPrefix . 'stewardshippostascreatedby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipPostAsCreatedByArray[] = StewardshipPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipPostAsCreatedBy = StewardshipPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostascreatedby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a single ClassInstructor 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 ClassInstructor 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 ClassInstructor::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray); }
/** * Instantiate a ClassMeeting from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ClassMeeting::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 ClassMeeting */ 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 . 'signup_form_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intSignupFormId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'class_meeting__'; } $strAlias = $strAliasPrefix . 'classregistration__signup_entry_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->_objClassRegistrationArray)) { $objPreviousChildItem = $objPreviousItem->_objClassRegistrationArray[$intPreviousChildItemCount - 1]; $objChildItem = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classregistration__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objClassRegistrationArray[] = $objChildItem; } } else { $objPreviousItem->_objClassRegistrationArray[] = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classregistration__', $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 == 'class_meeting__') { $strAliasPrefix = null; } } } // Create a new instance of the ClassMeeting object $objToReturn = new ClassMeeting(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'signup_form_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_form_id'] : $strAliasPrefix . 'signup_form_id'; $objToReturn->intSignupFormId = $objDbRow->GetColumn($strAliasName, 'Integer'); $objToReturn->__intSignupFormId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'class_term_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_term_id'] : $strAliasPrefix . 'class_term_id'; $objToReturn->intClassTermId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'class_course_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_course_id'] : $strAliasPrefix . 'class_course_id'; $objToReturn->intClassCourseId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'class_instructor_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_instructor_id'] : $strAliasPrefix . 'class_instructor_id'; $objToReturn->intClassInstructorId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'date_start', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_start'] : $strAliasPrefix . 'date_start'; $objToReturn->dttDateStart = $objDbRow->GetColumn($strAliasName, 'Date'); $strAliasName = array_key_exists($strAliasPrefix . 'date_end', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_end'] : $strAliasPrefix . 'date_end'; $objToReturn->dttDateEnd = $objDbRow->GetColumn($strAliasName, 'Date'); $strAliasName = array_key_exists($strAliasPrefix . 'location', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'location'] : $strAliasPrefix . 'location'; $objToReturn->strLocation = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'meeting_day', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'meeting_day'] : $strAliasPrefix . 'meeting_day'; $objToReturn->intMeetingDay = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'meeting_start_time', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'meeting_start_time'] : $strAliasPrefix . 'meeting_start_time'; $objToReturn->intMeetingStartTime = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'meeting_end_time', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'meeting_end_time'] : $strAliasPrefix . 'meeting_end_time'; $objToReturn->intMeetingEndTime = $objDbRow->GetColumn($strAliasName, '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_meeting__'; } // Check for SignupForm Early Binding $strAlias = $strAliasPrefix . 'signup_form_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objSignupForm = SignupForm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signup_form_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassTerm Early Binding $strAlias = $strAliasPrefix . 'class_term_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassTerm = ClassTerm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_term_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassCourse Early Binding $strAlias = $strAliasPrefix . 'class_course_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassCourse = ClassCourse::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_course_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassInstructor Early Binding $strAlias = $strAliasPrefix . 'class_instructor_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassInstructor = ClassInstructor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_instructor_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassRegistration Virtual Binding $strAlias = $strAliasPrefix . 'classregistration__signup_entry_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objClassRegistrationArray[] = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classregistration__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objClassRegistration = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classregistration__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }