/** * Instantiate a ParentPagerIndividual from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ParentPagerIndividual::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 ParentPagerIndividual */ 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 = 'parent_pager_individual__'; } $strAlias = $strAliasPrefix . 'parentpageraddress__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->_objParentPagerAddressArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerAddressArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerAddress::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpageraddress__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerAddressArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerAddressArray[] = ParentPagerAddress::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpageraddress__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'parentpagerattendanthistory__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->_objParentPagerAttendantHistoryArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerAttendantHistoryArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerAttendantHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerattendanthistory__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerAttendantHistoryArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerAttendantHistoryArray[] = ParentPagerAttendantHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerattendanthistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'parentpagerchildhistoryaspickupby__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->_objParentPagerChildHistoryAsPickupByArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerChildHistoryAsPickupByArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryaspickupby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerChildHistoryAsPickupByArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerChildHistoryAsPickupByArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryaspickupby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'parentpagerchildhistory__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->_objParentPagerChildHistoryArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerChildHistoryArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistory__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerChildHistoryArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerChildHistoryArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__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->_objParentPagerChildHistoryAsDropoffByArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerChildHistoryAsDropoffByArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerChildHistoryAsDropoffByArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerChildHistoryAsDropoffByArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__', $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 == 'parent_pager_individual__') { $strAliasPrefix = null; } } } // Create a new instance of the ParentPagerIndividual object $objToReturn = new ParentPagerIndividual(); $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 . 'server_identifier', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'server_identifier'] : $strAliasPrefix . 'server_identifier'; $objToReturn->intServerIdentifier = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'hidden_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'hidden_flag'] : $strAliasPrefix . 'hidden_flag'; $objToReturn->blnHiddenFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'parent_pager_sync_status_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_sync_status_type_id'] : $strAliasPrefix . 'parent_pager_sync_status_type_id'; $objToReturn->intParentPagerSyncStatusTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'parent_pager_household_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_household_id'] : $strAliasPrefix . 'parent_pager_household_id'; $objToReturn->intParentPagerHouseholdId = $objDbRow->GetColumn($strAliasName, 'Integer'); $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_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'middle_name'] : $strAliasPrefix . 'middle_name'; $objToReturn->strMiddleName = $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'); $strAliasName = array_key_exists($strAliasPrefix . 'prefix', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'prefix'] : $strAliasPrefix . 'prefix'; $objToReturn->strPrefix = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'suffix', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'suffix'] : $strAliasPrefix . 'suffix'; $objToReturn->strSuffix = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'nickname', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'nickname'] : $strAliasPrefix . 'nickname'; $objToReturn->strNickname = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'graduation_year', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'graduation_year'] : $strAliasPrefix . 'graduation_year'; $objToReturn->intGraduationYear = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'gender', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'gender'] : $strAliasPrefix . 'gender'; $objToReturn->strGender = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'date_of_birth', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_of_birth'] : $strAliasPrefix . 'date_of_birth'; $objToReturn->dttDateOfBirth = $objDbRow->GetColumn($strAliasName, 'Date'); // 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 = 'parent_pager_individual__'; } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ParentPagerHousehold Early Binding $strAlias = $strAliasPrefix . 'parent_pager_household_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objParentPagerHousehold = ParentPagerHousehold::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_pager_household_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ParentPagerAddress Virtual Binding $strAlias = $strAliasPrefix . 'parentpageraddress__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerAddressArray[] = ParentPagerAddress::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpageraddress__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerAddress = ParentPagerAddress::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpageraddress__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ParentPagerAttendantHistory Virtual Binding $strAlias = $strAliasPrefix . 'parentpagerattendanthistory__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerAttendantHistoryArray[] = ParentPagerAttendantHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerattendanthistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerAttendantHistory = ParentPagerAttendantHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerattendanthistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ParentPagerChildHistoryAsPickupBy Virtual Binding $strAlias = $strAliasPrefix . 'parentpagerchildhistoryaspickupby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerChildHistoryAsPickupByArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryaspickupby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerChildHistoryAsPickupBy = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryaspickupby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ParentPagerChildHistory Virtual Binding $strAlias = $strAliasPrefix . 'parentpagerchildhistory__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerChildHistoryArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerChildHistory = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistory__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ParentPagerChildHistoryAsDropoffBy Virtual Binding $strAlias = $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerChildHistoryAsDropoffByArray[] = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerChildHistoryAsDropoffBy = ParentPagerChildHistory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerchildhistoryasdropoffby__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a IssueFieldOption from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this IssueFieldOption::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 IssueFieldOption */ 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 = 'issue_field_option__'; } $strAlias = $strAliasPrefix . 'issuefieldvalue__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->_objIssueFieldValueArray)) { $objPreviousChildItem = $objPreviousItem->_objIssueFieldValueArray[$intPreviousChildItemCount - 1]; $objChildItem = IssueFieldValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuefieldvalue__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objIssueFieldValueArray[] = $objChildItem; } } else { $objPreviousItem->_objIssueFieldValueArray[] = IssueFieldValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuefieldvalue__', $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 == 'issue_field_option__') { $strAliasPrefix = null; } } } // Create a new instance of the IssueFieldOption object $objToReturn = new IssueFieldOption(); $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 . 'issue_field_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'issue_field_id'] : $strAliasPrefix . 'issue_field_id'; $objToReturn->intIssueFieldId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'token', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'token'] : $strAliasPrefix . 'token'; $objToReturn->strToken = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'order_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'order_number'] : $strAliasPrefix . 'order_number'; $objToReturn->intOrderNumber = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'active_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'active_flag'] : $strAliasPrefix . 'active_flag'; $objToReturn->blnActiveFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); // 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 = 'issue_field_option__'; } // Check for IssueField Early Binding $strAlias = $strAliasPrefix . 'issue_field_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objIssueField = IssueField::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issue_field_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for IssueFieldValue Virtual Binding $strAlias = $strAliasPrefix . 'issuefieldvalue__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objIssueFieldValueArray[] = IssueFieldValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuefieldvalue__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objIssueFieldValue = IssueFieldValue::InstantiateDbRow($objDbRow, $strAliasPrefix . 'issuefieldvalue__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a AssetCustomFieldHelper from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this AssetCustomFieldHelper::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 AssetCustomFieldHelper */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the AssetCustomFieldHelper object $objToReturn = new AssetCustomFieldHelper(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'asset_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'asset_id'] : $strAliasPrefix . 'asset_id'; $objToReturn->intAssetId = $objDbRow->GetColumn($strAliasName, 'Integer'); $objToReturn->__intAssetId = $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 = 'asset_custom_field_helper__'; } // Check for Asset Early Binding $strAlias = $strAliasPrefix . 'asset_id__asset_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objAsset = Asset::InstantiateDbRow($objDbRow, $strAliasPrefix . 'asset_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a StewardshipContributionAmount from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this StewardshipContributionAmount::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 StewardshipContributionAmount */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the StewardshipContributionAmount object $objToReturn = new StewardshipContributionAmount(); $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 . 'stewardship_contribution_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'stewardship_contribution_id'] : $strAliasPrefix . 'stewardship_contribution_id'; $objToReturn->intStewardshipContributionId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'stewardship_fund_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'stewardship_fund_id'] : $strAliasPrefix . 'stewardship_fund_id'; $objToReturn->intStewardshipFundId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'amount', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount'] : $strAliasPrefix . 'amount'; $objToReturn->fltAmount = $objDbRow->GetColumn($strAliasName, 'Float'); // 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 = 'stewardship_contribution_amount__'; } // Check for StewardshipContribution Early Binding $strAlias = $strAliasPrefix . 'stewardship_contribution_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objStewardshipContribution = StewardshipContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardship_contribution_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for StewardshipFund Early Binding $strAlias = $strAliasPrefix . 'stewardship_fund_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objStewardshipFund = StewardshipFund::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardship_fund_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a Role from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Role::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 Role */ 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 . 'role_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intRoleId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'role__'; } $strAlias = $strAliasPrefix . 'roleentityqtypebuiltinauthorization__role_entity_built_in_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->_objRoleEntityQtypeBuiltInAuthorizationArray)) { $objPreviousChildItem = $objPreviousItem->_objRoleEntityQtypeBuiltInAuthorizationArray[$intPreviousChildItemCount - 1]; $objChildItem = RoleEntityQtypeBuiltInAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypebuiltinauthorization__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objRoleEntityQtypeBuiltInAuthorizationArray[] = $objChildItem; } } else { $objPreviousItem->_objRoleEntityQtypeBuiltInAuthorizationArray[] = RoleEntityQtypeBuiltInAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypebuiltinauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__role_entity_qtype_custom_field_authorization_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->_objRoleEntityQtypeCustomFieldAuthorizationArray)) { $objPreviousChildItem = $objPreviousItem->_objRoleEntityQtypeCustomFieldAuthorizationArray[$intPreviousChildItemCount - 1]; $objChildItem = RoleEntityQtypeCustomFieldAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objRoleEntityQtypeCustomFieldAuthorizationArray[] = $objChildItem; } } else { $objPreviousItem->_objRoleEntityQtypeCustomFieldAuthorizationArray[] = RoleEntityQtypeCustomFieldAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'rolemodule__role_module_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->_objRoleModuleArray)) { $objPreviousChildItem = $objPreviousItem->_objRoleModuleArray[$intPreviousChildItemCount - 1]; $objChildItem = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'rolemodule__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objRoleModuleArray[] = $objChildItem; } } else { $objPreviousItem->_objRoleModuleArray[] = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'rolemodule__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'roletransactiontypeauthorization__role_transaction_type_authorization_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->_objRoleTransactionTypeAuthorizationArray)) { $objPreviousChildItem = $objPreviousItem->_objRoleTransactionTypeAuthorizationArray[$intPreviousChildItemCount - 1]; $objChildItem = RoleTransactionTypeAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roletransactiontypeauthorization__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objRoleTransactionTypeAuthorizationArray[] = $objChildItem; } } else { $objPreviousItem->_objRoleTransactionTypeAuthorizationArray[] = RoleTransactionTypeAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roletransactiontypeauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'useraccount__user_account_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->_objUserAccountArray)) { $objPreviousChildItem = $objPreviousItem->_objUserAccountArray[$intPreviousChildItemCount - 1]; $objChildItem = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'useraccount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objUserAccountArray[] = $objChildItem; } } else { $objPreviousItem->_objUserAccountArray[] = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'useraccount__', $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 == 'role__') { $strAliasPrefix = null; } } } // Create a new instance of the Role object $objToReturn = new Role(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'role_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_id'] : $strAliasPrefix . 'role_id'; $objToReturn->intRoleId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description'; $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'long_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'long_description'] : $strAliasPrefix . 'long_description'; $objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by'; $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date'; $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by'; $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date'; $objToReturn->strModifiedDate = $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 = 'role__'; } // Check for CreatedByObject Early Binding $strAlias = $strAliasPrefix . 'created_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ModifiedByObject Early Binding $strAlias = $strAliasPrefix . 'modified_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for RoleEntityQtypeBuiltInAuthorization Virtual Binding $strAlias = $strAliasPrefix . 'roleentityqtypebuiltinauthorization__role_entity_built_in_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objRoleEntityQtypeBuiltInAuthorizationArray[] = RoleEntityQtypeBuiltInAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypebuiltinauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objRoleEntityQtypeBuiltInAuthorization = RoleEntityQtypeBuiltInAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypebuiltinauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for RoleEntityQtypeCustomFieldAuthorization Virtual Binding $strAlias = $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__role_entity_qtype_custom_field_authorization_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objRoleEntityQtypeCustomFieldAuthorizationArray[] = RoleEntityQtypeCustomFieldAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objRoleEntityQtypeCustomFieldAuthorization = RoleEntityQtypeCustomFieldAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roleentityqtypecustomfieldauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for RoleModule Virtual Binding $strAlias = $strAliasPrefix . 'rolemodule__role_module_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objRoleModuleArray[] = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'rolemodule__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objRoleModule = RoleModule::InstantiateDbRow($objDbRow, $strAliasPrefix . 'rolemodule__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for RoleTransactionTypeAuthorization Virtual Binding $strAlias = $strAliasPrefix . 'roletransactiontypeauthorization__role_transaction_type_authorization_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objRoleTransactionTypeAuthorizationArray[] = RoleTransactionTypeAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roletransactiontypeauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'roletransactiontypeauthorization__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for UserAccount Virtual Binding $strAlias = $strAliasPrefix . 'useraccount__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objUserAccountArray[] = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'useraccount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objUserAccount = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'useraccount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a EmailMessageRoute from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this EmailMessageRoute::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 EmailMessageRoute */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the EmailMessageRoute object $objToReturn = new EmailMessageRoute(); $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 . 'email_message_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_message_id'] : $strAliasPrefix . 'email_message_id'; $objToReturn->intEmailMessageId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'group_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'group_id'] : $strAliasPrefix . 'group_id'; $objToReturn->intGroupId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'communication_list_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'communication_list_id'] : $strAliasPrefix . 'communication_list_id'; $objToReturn->intCommunicationListId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'login_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'login_id'] : $strAliasPrefix . 'login_id'; $objToReturn->intLoginId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'communication_list_entry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'communication_list_entry_id'] : $strAliasPrefix . 'communication_list_entry_id'; $objToReturn->intCommunicationListEntryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $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 = 'email_message_route__'; } // Check for EmailMessage Early Binding $strAlias = $strAliasPrefix . 'email_message_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objEmailMessage = EmailMessage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'email_message_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Group Early Binding $strAlias = $strAliasPrefix . 'group_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objGroup = Group::InstantiateDbRow($objDbRow, $strAliasPrefix . 'group_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CommunicationList Early Binding $strAlias = $strAliasPrefix . 'communication_list_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCommunicationList = CommunicationList::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communication_list_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Login Early Binding $strAlias = $strAliasPrefix . 'login_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objLogin = Login::InstantiateDbRow($objDbRow, $strAliasPrefix . 'login_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CommunicationListEntry Early Binding $strAlias = $strAliasPrefix . 'communication_list_entry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCommunicationListEntry = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communication_list_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a GrowthGroupStructure from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this GrowthGroupStructure::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 GrowthGroupStructure */ 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 = 'growth_group_structure__'; } $strAlias = $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_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->_objGroupRegistrationsAsGroupstructureArray)) { $objPreviousChildItem = $objPreviousItem->_objGroupRegistrationsAsGroupstructureArray[$intPreviousChildItemCount - 1]; $objChildItem = GroupRegistrations::InstantiateDbRow($objDbRow, $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objGroupRegistrationsAsGroupstructureArray[] = $objChildItem; } } else { $objPreviousItem->_objGroupRegistrationsAsGroupstructureArray[] = GroupRegistrations::InstantiateDbRow($objDbRow, $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'growthgroup__growth_group_id__group_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->_objGrowthGroupArray)) { $objPreviousChildItem = $objPreviousItem->_objGrowthGroupArray[$intPreviousChildItemCount - 1]; $objChildItem = GrowthGroup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroup__growth_group_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objGrowthGroupArray[] = $objChildItem; } } else { $objPreviousItem->_objGrowthGroupArray[] = GrowthGroup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroup__growth_group_id__', $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 == 'growth_group_structure__') { $strAliasPrefix = null; } } } // Create a new instance of the GrowthGroupStructure object $objToReturn = new GrowthGroupStructure(); $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 . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $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 = 'growth_group_structure__'; } // Check for GroupRegistrationsAsGroupstructure Virtual Binding $strAlias = $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_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->_objGroupRegistrationsAsGroupstructureArray[] = GroupRegistrations::InstantiateDbRow($objDbRow, $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objGroupRegistrationsAsGroupstructure = GroupRegistrations::InstantiateDbRow($objDbRow, $strAliasPrefix . 'groupregistrationsasgroupstructure__group_registrations_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for GrowthGroup Virtual Binding $strAlias = $strAliasPrefix . 'growthgroup__growth_group_id__group_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objGrowthGroupArray[] = GrowthGroup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroup__growth_group_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objGrowthGroup = GrowthGroup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroup__growth_group_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a StewardshipPost from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this StewardshipPost::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 StewardshipPost */ 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 = 'stewardship_post__'; } $strAlias = $strAliasPrefix . 'stewardshippostamount__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->_objStewardshipPostAmountArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipPostAmountArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipPostAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostamount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipPostAmountArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipPostAmountArray[] = StewardshipPostAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshippostlineitem__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->_objStewardshipPostLineItemArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipPostLineItemArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipPostLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostlineitem__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipPostLineItemArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipPostLineItemArray[] = StewardshipPostLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostlineitem__', $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 == 'stewardship_post__') { $strAliasPrefix = null; } } } // Create a new instance of the StewardshipPost object $objToReturn = new StewardshipPost(); $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 . 'stewardship_batch_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'stewardship_batch_id'] : $strAliasPrefix . 'stewardship_batch_id'; $objToReturn->intStewardshipBatchId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'post_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'post_number'] : $strAliasPrefix . 'post_number'; $objToReturn->intPostNumber = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'date_posted', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_posted'] : $strAliasPrefix . 'date_posted'; $objToReturn->dttDatePosted = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'total_amount', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'total_amount'] : $strAliasPrefix . 'total_amount'; $objToReturn->fltTotalAmount = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by_login_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by_login_id'] : $strAliasPrefix . 'created_by_login_id'; $objToReturn->intCreatedByLoginId = $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 = 'stewardship_post__'; } // Check for StewardshipBatch Early Binding $strAlias = $strAliasPrefix . 'stewardship_batch_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objStewardshipBatch = StewardshipBatch::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardship_batch_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CreatedByLogin Early Binding $strAlias = $strAliasPrefix . 'created_by_login_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByLogin = Login::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by_login_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for StewardshipPostAmount Virtual Binding $strAlias = $strAliasPrefix . 'stewardshippostamount__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipPostAmountArray[] = StewardshipPostAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipPostAmount = StewardshipPostAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipPostLineItem Virtual Binding $strAlias = $strAliasPrefix . 'stewardshippostlineitem__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipPostLineItemArray[] = StewardshipPostLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostlineitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipPostLineItem = StewardshipPostLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippostlineitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a HouseholdParticipation from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this HouseholdParticipation::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 HouseholdParticipation */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the HouseholdParticipation object $objToReturn = new HouseholdParticipation(); $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 . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'household_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'household_id'] : $strAliasPrefix . 'household_id'; $objToReturn->intHouseholdId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'role', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role'] : $strAliasPrefix . 'role'; $objToReturn->strRole = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'role_override', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_override'] : $strAliasPrefix . 'role_override'; $objToReturn->strRoleOverride = $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 = 'household_participation__'; } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Household Early Binding $strAlias = $strAliasPrefix . 'household_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objHousehold = Household::InstantiateDbRow($objDbRow, $strAliasPrefix . 'household_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a FormAnswer from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this FormAnswer::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 FormAnswer */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the FormAnswer object $objToReturn = new FormAnswer(); $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 . 'signup_entry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_entry_id'] : $strAliasPrefix . 'signup_entry_id'; $objToReturn->intSignupEntryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'form_question_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'form_question_id'] : $strAliasPrefix . 'form_question_id'; $objToReturn->intFormQuestionId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'text_value', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'text_value'] : $strAliasPrefix . 'text_value'; $objToReturn->strTextValue = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'address_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address_id'] : $strAliasPrefix . 'address_id'; $objToReturn->intAddressId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'phone_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'phone_id'] : $strAliasPrefix . 'phone_id'; $objToReturn->intPhoneId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'email_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_id'] : $strAliasPrefix . 'email_id'; $objToReturn->intEmailId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'integer_value', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'integer_value'] : $strAliasPrefix . 'integer_value'; $objToReturn->intIntegerValue = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'boolean_value', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'boolean_value'] : $strAliasPrefix . 'boolean_value'; $objToReturn->blnBooleanValue = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'date_value', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_value'] : $strAliasPrefix . 'date_value'; $objToReturn->dttDateValue = $objDbRow->GetColumn($strAliasName, 'Date'); // 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 = 'form_answer__'; } // Check for SignupEntry Early Binding $strAlias = $strAliasPrefix . 'signup_entry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objSignupEntry = SignupEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signup_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for FormQuestion Early Binding $strAlias = $strAliasPrefix . 'form_question_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objFormQuestion = FormQuestion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'form_question_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Address Early Binding $strAlias = $strAliasPrefix . 'address_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objAddress = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Phone Early Binding $strAlias = $strAliasPrefix . 'phone_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPhone = Phone::InstantiateDbRow($objDbRow, $strAliasPrefix . 'phone_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Email Early Binding $strAlias = $strAliasPrefix . 'email_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objEmail = Email::InstantiateDbRow($objDbRow, $strAliasPrefix . 'email_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a Registry from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Registry::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 Registry */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the Registry object $objToReturn = new Registry(); $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 . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'value', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'value'] : $strAliasPrefix . 'value'; $objToReturn->strValue = $objDbRow->GetColumn($strAliasName, '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 = 'registry__'; } return $objToReturn; }
/** * Instantiate a Company from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Company::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 Company */ 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 . 'company_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intCompanyId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'company__'; } $strAlias = $strAliasPrefix . 'address__address_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->_objAddressArray)) { $objPreviousChildItem = $objPreviousItem->_objAddressArray[$intPreviousChildItemCount - 1]; $objChildItem = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objAddressArray[] = $objChildItem; } } else { $objPreviousItem->_objAddressArray[] = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'contact__contact_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->_objContactArray)) { $objPreviousChildItem = $objPreviousItem->_objContactArray[$intPreviousChildItemCount - 1]; $objChildItem = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objContactArray[] = $objChildItem; } } else { $objPreviousItem->_objContactArray[] = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'receiptasfrom__receipt_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->_objReceiptAsFromArray)) { $objPreviousChildItem = $objPreviousItem->_objReceiptAsFromArray[$intPreviousChildItemCount - 1]; $objChildItem = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objReceiptAsFromArray[] = $objChildItem; } } else { $objPreviousItem->_objReceiptAsFromArray[] = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'shipmentasfrom__shipment_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->_objShipmentAsFromArray)) { $objPreviousChildItem = $objPreviousItem->_objShipmentAsFromArray[$intPreviousChildItemCount - 1]; $objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objShipmentAsFromArray[] = $objChildItem; } } else { $objPreviousItem->_objShipmentAsFromArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'shipmentasto__shipment_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->_objShipmentAsToArray)) { $objPreviousChildItem = $objPreviousItem->_objShipmentAsToArray[$intPreviousChildItemCount - 1]; $objChildItem = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objShipmentAsToArray[] = $objChildItem; } } else { $objPreviousItem->_objShipmentAsToArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $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 == 'company__') { $strAliasPrefix = null; } } } // Create a new instance of the Company object $objToReturn = new Company(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'company_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'company_id'] : $strAliasPrefix . 'company_id'; $objToReturn->intCompanyId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'address_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address_id'] : $strAliasPrefix . 'address_id'; $objToReturn->intAddressId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description'; $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'website', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'website'] : $strAliasPrefix . 'website'; $objToReturn->strWebsite = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'telephone', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'telephone'] : $strAliasPrefix . 'telephone'; $objToReturn->strTelephone = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'fax', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fax'] : $strAliasPrefix . 'fax'; $objToReturn->strFax = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'email', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email'] : $strAliasPrefix . 'email'; $objToReturn->strEmail = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'long_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'long_description'] : $strAliasPrefix . 'long_description'; $objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by'; $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date'; $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by'; $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date'; $objToReturn->strModifiedDate = $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 = 'company__'; } // Check for Address Early Binding $strAlias = $strAliasPrefix . 'address_id__address_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objAddress = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CreatedByObject Early Binding $strAlias = $strAliasPrefix . 'created_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ModifiedByObject Early Binding $strAlias = $strAliasPrefix . 'modified_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CompanyCustomFieldHelper Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'companycustomfieldhelper__company_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCompanyCustomFieldHelper = CompanyCustomFieldHelper::InstantiateDbRow($objDbRow, $strAliasPrefix . 'companycustomfieldhelper__', $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->objCompanyCustomFieldHelper = false; } } // Check for Address Virtual Binding $strAlias = $strAliasPrefix . 'address__address_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objAddressArray[] = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objAddress = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for Contact Virtual Binding $strAlias = $strAliasPrefix . 'contact__contact_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objContactArray[] = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objContact = Contact::InstantiateDbRow($objDbRow, $strAliasPrefix . 'contact__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ReceiptAsFrom Virtual Binding $strAlias = $strAliasPrefix . 'receiptasfrom__receipt_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objReceiptAsFromArray[] = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objReceiptAsFrom = Receipt::InstantiateDbRow($objDbRow, $strAliasPrefix . 'receiptasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ShipmentAsFrom Virtual Binding $strAlias = $strAliasPrefix . 'shipmentasfrom__shipment_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objShipmentAsFromArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objShipmentAsFrom = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasfrom__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ShipmentAsTo Virtual Binding $strAlias = $strAliasPrefix . 'shipmentasto__shipment_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objShipmentAsToArray[] = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objShipmentAsTo = Shipment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'shipmentasto__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a GrowthGroup from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this GrowthGroup::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 GrowthGroup */ 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 . 'group_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intGroupId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'growth_group__'; } $strAlias = $strAliasPrefix . 'growthgroupstructure__growth_group_structure_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->_objGrowthGroupStructureArray)) { $objPreviousChildItem = $objPreviousItem->_objGrowthGroupStructureArray[$intPreviousChildItemCount - 1]; $objChildItem = GrowthGroupStructure::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroupstructure__growth_group_structure_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objGrowthGroupStructureArray[] = $objChildItem; } } else { $objPreviousItem->_objGrowthGroupStructureArray[] = GrowthGroupStructure::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroupstructure__growth_group_structure_id__', $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 == 'growth_group__') { $strAliasPrefix = null; } } } // Create a new instance of the GrowthGroup object $objToReturn = new GrowthGroup(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'group_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'group_id'] : $strAliasPrefix . 'group_id'; $objToReturn->intGroupId = $objDbRow->GetColumn($strAliasName, 'Integer'); $objToReturn->__intGroupId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'growth_group_location_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'growth_group_location_id'] : $strAliasPrefix . 'growth_group_location_id'; $objToReturn->intGrowthGroupLocationId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'growth_group_day_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'growth_group_day_type_id'] : $strAliasPrefix . 'growth_group_day_type_id'; $objToReturn->intGrowthGroupDayTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'meeting_bitmap', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'meeting_bitmap'] : $strAliasPrefix . 'meeting_bitmap'; $objToReturn->intMeetingBitmap = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'start_time', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'start_time'] : $strAliasPrefix . 'start_time'; $objToReturn->intStartTime = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'end_time', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'end_time'] : $strAliasPrefix . 'end_time'; $objToReturn->intEndTime = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'address_1', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address_1'] : $strAliasPrefix . 'address_1'; $objToReturn->strAddress1 = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'address_2', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address_2'] : $strAliasPrefix . 'address_2'; $objToReturn->strAddress2 = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'cross_street_1', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'cross_street_1'] : $strAliasPrefix . 'cross_street_1'; $objToReturn->strCrossStreet1 = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'cross_street_2', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'cross_street_2'] : $strAliasPrefix . 'cross_street_2'; $objToReturn->strCrossStreet2 = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'zip_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'zip_code'] : $strAliasPrefix . 'zip_code'; $objToReturn->strZipCode = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'longitude', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'longitude'] : $strAliasPrefix . 'longitude'; $objToReturn->fltLongitude = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'latitude', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'latitude'] : $strAliasPrefix . 'latitude'; $objToReturn->fltLatitude = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'accuracy', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'accuracy'] : $strAliasPrefix . 'accuracy'; $objToReturn->intAccuracy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description'; $objToReturn->strDescription = $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 = 'growth_group__'; } // Check for Group Early Binding $strAlias = $strAliasPrefix . 'group_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objGroup = Group::InstantiateDbRow($objDbRow, $strAliasPrefix . 'group_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for GrowthGroupLocation Early Binding $strAlias = $strAliasPrefix . 'growth_group_location_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objGrowthGroupLocation = GrowthGroupLocation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growth_group_location_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for GrowthGroupStructure Virtual Binding $strAlias = $strAliasPrefix . 'growthgroupstructure__growth_group_structure_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->_objGrowthGroupStructureArray[] = GrowthGroupStructure::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroupstructure__growth_group_structure_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objGrowthGroupStructure = GrowthGroupStructure::InstantiateDbRow($objDbRow, $strAliasPrefix . 'growthgroupstructure__growth_group_structure_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a Datagrid from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Datagrid::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 Datagrid */ 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 . 'datagrid_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intDatagridId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'datagrid__'; } $strAlias = $strAliasPrefix . 'datagridcolumnpreference__datagrid_column_preference_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->_objDatagridColumnPreferenceArray)) { $objPreviousChildItem = $objPreviousItem->_objDatagridColumnPreferenceArray[$intPreviousChildItemCount - 1]; $objChildItem = DatagridColumnPreference::InstantiateDbRow($objDbRow, $strAliasPrefix . 'datagridcolumnpreference__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objDatagridColumnPreferenceArray[] = $objChildItem; } } else { $objPreviousItem->_objDatagridColumnPreferenceArray[] = DatagridColumnPreference::InstantiateDbRow($objDbRow, $strAliasPrefix . 'datagridcolumnpreference__', $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 == 'datagrid__') { $strAliasPrefix = null; } } } // Create a new instance of the Datagrid object $objToReturn = new Datagrid(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'datagrid_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'datagrid_id'] : $strAliasPrefix . 'datagrid_id'; $objToReturn->intDatagridId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description'; $objToReturn->strShortDescription = $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 = 'datagrid__'; } // Check for DatagridColumnPreference Virtual Binding $strAlias = $strAliasPrefix . 'datagridcolumnpreference__datagrid_column_preference_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objDatagridColumnPreferenceArray[] = DatagridColumnPreference::InstantiateDbRow($objDbRow, $strAliasPrefix . 'datagridcolumnpreference__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objDatagridColumnPreference = DatagridColumnPreference::InstantiateDbRow($objDbRow, $strAliasPrefix . 'datagridcolumnpreference__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a ClassifiedCategory from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ClassifiedCategory::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 ClassifiedCategory */ 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 = 'classified_category__'; } $strAlias = $strAliasPrefix . 'classifiedpost__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->_objClassifiedPostArray)) { $objPreviousChildItem = $objPreviousItem->_objClassifiedPostArray[$intPreviousChildItemCount - 1]; $objChildItem = ClassifiedPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classifiedpost__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objClassifiedPostArray[] = $objChildItem; } } else { $objPreviousItem->_objClassifiedPostArray[] = ClassifiedPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classifiedpost__', $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 == 'classified_category__') { $strAliasPrefix = null; } } } // Create a new instance of the ClassifiedCategory object $objToReturn = new ClassifiedCategory(); $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 . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'token', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'token'] : $strAliasPrefix . 'token'; $objToReturn->strToken = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'order_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'order_number'] : $strAliasPrefix . 'order_number'; $objToReturn->intOrderNumber = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description'; $objToReturn->strDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'instructions', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'instructions'] : $strAliasPrefix . 'instructions'; $objToReturn->strInstructions = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'disclaimer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'disclaimer'] : $strAliasPrefix . 'disclaimer'; $objToReturn->strDisclaimer = $objDbRow->GetColumn($strAliasName, '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 = 'classified_category__'; } // Check for ClassifiedPost Virtual Binding $strAlias = $strAliasPrefix . 'classifiedpost__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objClassifiedPostArray[] = ClassifiedPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classifiedpost__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objClassifiedPost = ClassifiedPost::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classifiedpost__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a SmsMessage from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this SmsMessage::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 SmsMessage */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the SmsMessage object $objToReturn = new SmsMessage(); $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 . 'group_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'group_id'] : $strAliasPrefix . 'group_id'; $objToReturn->intGroupId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'login_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'login_id'] : $strAliasPrefix . 'login_id'; $objToReturn->intLoginId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'subject', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'subject'] : $strAliasPrefix . 'subject'; $objToReturn->strSubject = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'body', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'body'] : $strAliasPrefix . 'body'; $objToReturn->strBody = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'date_queued', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_queued'] : $strAliasPrefix . 'date_queued'; $objToReturn->dttDateQueued = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_sent', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_sent'] : $strAliasPrefix . 'date_sent'; $objToReturn->dttDateSent = $objDbRow->GetColumn($strAliasName, 'DateTime'); // 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 = 'sms_message__'; } // Check for Group Early Binding $strAlias = $strAliasPrefix . 'group_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objGroup = Group::InstantiateDbRow($objDbRow, $strAliasPrefix . 'group_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Login Early Binding $strAlias = $strAliasPrefix . 'login_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objLogin = Login::InstantiateDbRow($objDbRow, $strAliasPrefix . 'login_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a Package from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Package::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 Package */ 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 = 'package__'; } $strAlias = $strAliasPrefix . 'packagecontribution__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->_objPackageContributionArray)) { $objPreviousChildItem = $objPreviousItem->_objPackageContributionArray[$intPreviousChildItemCount - 1]; $objChildItem = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objPackageContributionArray[] = $objChildItem; } } else { $objPreviousItem->_objPackageContributionArray[] = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $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 == 'package__') { $strAliasPrefix = null; } } } // Create a new instance of the Package object $objToReturn = new Package(); $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 . 'package_category_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'package_category_id'] : $strAliasPrefix . 'package_category_id'; $objToReturn->intPackageCategoryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'token', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'token'] : $strAliasPrefix . 'token'; $objToReturn->strToken = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description'; $objToReturn->strDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'last_post_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'last_post_date'] : $strAliasPrefix . 'last_post_date'; $objToReturn->dttLastPostDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'last_posted_by_person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'last_posted_by_person_id'] : $strAliasPrefix . 'last_posted_by_person_id'; $objToReturn->intLastPostedByPersonId = $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 = 'package__'; } // Check for PackageCategory Early Binding $strAlias = $strAliasPrefix . 'package_category_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPackageCategory = PackageCategory::InstantiateDbRow($objDbRow, $strAliasPrefix . 'package_category_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for LastPostedByPerson Early Binding $strAlias = $strAliasPrefix . 'last_posted_by_person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objLastPostedByPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'last_posted_by_person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for TopicLink Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'topiclink__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objTopicLink = TopicLink::InstantiateDbRow($objDbRow, $strAliasPrefix . 'topiclink__', $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->objTopicLink = false; } } // Check for PackageContribution Virtual Binding $strAlias = $strAliasPrefix . 'packagecontribution__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objPackageContributionArray[] = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objPackageContribution = PackageContribution::InstantiateDbRow($objDbRow, $strAliasPrefix . 'packagecontribution__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a ShowcaseItem from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ShowcaseItem::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 ShowcaseItem */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the ShowcaseItem object $objToReturn = new ShowcaseItem(); $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 . 'image_file_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_file_type_id'] : $strAliasPrefix . 'image_file_type_id'; $objToReturn->intImageFileTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description'; $objToReturn->strDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'url', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'url'] : $strAliasPrefix . 'url'; $objToReturn->strUrl = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'live_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'live_flag'] : $strAliasPrefix . 'live_flag'; $objToReturn->blnLiveFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); // 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 = 'showcase_item__'; } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a CommunicationList from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this CommunicationList::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 CommunicationList */ 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 = 'communication_list__'; } $strAlias = $strAliasPrefix . 'communicationlistentry__communication_list_entry_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->_objCommunicationListEntryArray)) { $objPreviousChildItem = $objPreviousItem->_objCommunicationListEntryArray[$intPreviousChildItemCount - 1]; $objChildItem = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlistentry__communication_list_entry_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objCommunicationListEntryArray[] = $objChildItem; } } else { $objPreviousItem->_objCommunicationListEntryArray[] = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlistentry__communication_list_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'person__person_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->_objPersonArray)) { $objPreviousChildItem = $objPreviousItem->_objPersonArray[$intPreviousChildItemCount - 1]; $objChildItem = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person__person_id__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objPersonArray[] = $objChildItem; } } else { $objPreviousItem->_objPersonArray[] = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person__person_id__', $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; } // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on if ($blnExpandedViaArray) { return false; } else { if ($strAliasPrefix == 'communication_list__') { $strAliasPrefix = null; } } } // Create a new instance of the CommunicationList object $objToReturn = new CommunicationList(); $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 . 'email_broadcast_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email_broadcast_type_id'] : $strAliasPrefix . 'email_broadcast_type_id'; $objToReturn->intEmailBroadcastTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'ministry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ministry_id'] : $strAliasPrefix . 'ministry_id'; $objToReturn->intMinistryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'token', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'token'] : $strAliasPrefix . 'token'; $objToReturn->strToken = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description'; $objToReturn->strDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'subscribable', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'subscribable'] : $strAliasPrefix . 'subscribable'; $objToReturn->blnSubscribable = $objDbRow->GetColumn($strAliasName, 'Bit'); // 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 = 'communication_list__'; } // Check for Ministry Early Binding $strAlias = $strAliasPrefix . 'ministry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objMinistry = Ministry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'ministry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CommunicationListEntry Virtual Binding $strAlias = $strAliasPrefix . 'communicationlistentry__communication_list_entry_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->_objCommunicationListEntryArray[] = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlistentry__communication_list_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objCommunicationListEntry = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communicationlistentry__communication_list_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for Person Virtual Binding $strAlias = $strAliasPrefix . 'person__person_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->_objPersonArray[] = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person__person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person__person_id__', $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); } } return $objToReturn; }
/** * Instantiate a ClassAttendence from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ClassAttendence::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 ClassAttendence */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the ClassAttendence object $objToReturn = new ClassAttendence(); $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 . 'class_registration_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_registration_id'] : $strAliasPrefix . 'class_registration_id'; $objToReturn->intClassRegistrationId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'meeting_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'meeting_number'] : $strAliasPrefix . 'meeting_number'; $objToReturn->intMeetingNumber = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'present_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'present_flag'] : $strAliasPrefix . 'present_flag'; $objToReturn->blnPresentFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); // 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_attendence__'; } // Check for ClassRegistration Early Binding $strAlias = $strAliasPrefix . 'class_registration_id__signup_entry_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassRegistration = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_registration_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a SignupEntry from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this SignupEntry::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 SignupEntry */ 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 = 'signup_entry__'; } $strAlias = $strAliasPrefix . 'formanswer__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->_objFormAnswerArray)) { $objPreviousChildItem = $objPreviousItem->_objFormAnswerArray[$intPreviousChildItemCount - 1]; $objChildItem = FormAnswer::InstantiateDbRow($objDbRow, $strAliasPrefix . 'formanswer__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objFormAnswerArray[] = $objChildItem; } } else { $objPreviousItem->_objFormAnswerArray[] = FormAnswer::InstantiateDbRow($objDbRow, $strAliasPrefix . 'formanswer__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'signuppayment__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->_objSignupPaymentArray)) { $objPreviousChildItem = $objPreviousItem->_objSignupPaymentArray[$intPreviousChildItemCount - 1]; $objChildItem = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppayment__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objSignupPaymentArray[] = $objChildItem; } } else { $objPreviousItem->_objSignupPaymentArray[] = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppayment__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'signupproduct__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->_objSignupProductArray)) { $objPreviousChildItem = $objPreviousItem->_objSignupProductArray[$intPreviousChildItemCount - 1]; $objChildItem = SignupProduct::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupproduct__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objSignupProductArray[] = $objChildItem; } } else { $objPreviousItem->_objSignupProductArray[] = SignupProduct::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupproduct__', $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 == 'signup_entry__') { $strAliasPrefix = null; } } } // Create a new instance of the SignupEntry object $objToReturn = new SignupEntry(); $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 . 'signup_form_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_form_id'] : $strAliasPrefix . 'signup_form_id'; $objToReturn->intSignupFormId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'signup_by_person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_by_person_id'] : $strAliasPrefix . 'signup_by_person_id'; $objToReturn->intSignupByPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'signup_entry_status_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_entry_status_type_id'] : $strAliasPrefix . 'signup_entry_status_type_id'; $objToReturn->intSignupEntryStatusTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'date_created', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_created'] : $strAliasPrefix . 'date_created'; $objToReturn->dttDateCreated = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_submitted', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_submitted'] : $strAliasPrefix . 'date_submitted'; $objToReturn->dttDateSubmitted = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'amount_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount_total'] : $strAliasPrefix . 'amount_total'; $objToReturn->fltAmountTotal = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'amount_paid', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount_paid'] : $strAliasPrefix . 'amount_paid'; $objToReturn->fltAmountPaid = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'amount_balance', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount_balance'] : $strAliasPrefix . 'amount_balance'; $objToReturn->fltAmountBalance = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'internal_notes', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'internal_notes'] : $strAliasPrefix . 'internal_notes'; $objToReturn->strInternalNotes = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'communications_entry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'communications_entry_id'] : $strAliasPrefix . 'communications_entry_id'; $objToReturn->intCommunicationsEntryId = $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 = 'signup_entry__'; } // 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 Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for SignupByPerson Early Binding $strAlias = $strAliasPrefix . 'signup_by_person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objSignupByPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signup_by_person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CommunicationsEntry Early Binding $strAlias = $strAliasPrefix . 'communications_entry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCommunicationsEntry = CommunicationListEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'communications_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassRegistration Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'classregistration__signup_entry_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassRegistration = ClassRegistration::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classregistration__', $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->objClassRegistration = false; } } // Check for FormAnswer Virtual Binding $strAlias = $strAliasPrefix . 'formanswer__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objFormAnswerArray[] = FormAnswer::InstantiateDbRow($objDbRow, $strAliasPrefix . 'formanswer__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objFormAnswer = FormAnswer::InstantiateDbRow($objDbRow, $strAliasPrefix . 'formanswer__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for SignupPayment Virtual Binding $strAlias = $strAliasPrefix . 'signuppayment__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objSignupPaymentArray[] = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppayment__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objSignupPayment = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppayment__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for SignupProduct Virtual Binding $strAlias = $strAliasPrefix . 'signupproduct__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objSignupProductArray[] = SignupProduct::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupproduct__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objSignupProduct = SignupProduct::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupproduct__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a ClassRegistration from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ClassRegistration::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 ClassRegistration */ 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_entry_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intSignupEntryId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'class_registration__'; } $strAlias = $strAliasPrefix . 'classattendence__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->_objClassAttendenceArray)) { $objPreviousChildItem = $objPreviousItem->_objClassAttendenceArray[$intPreviousChildItemCount - 1]; $objChildItem = ClassAttendence::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classattendence__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objClassAttendenceArray[] = $objChildItem; } } else { $objPreviousItem->_objClassAttendenceArray[] = ClassAttendence::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classattendence__', $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_registration__') { $strAliasPrefix = null; } } } // Create a new instance of the ClassRegistration object $objToReturn = new ClassRegistration(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'signup_entry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_entry_id'] : $strAliasPrefix . 'signup_entry_id'; $objToReturn->intSignupEntryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $objToReturn->__intSignupEntryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'class_meeting_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_meeting_id'] : $strAliasPrefix . 'class_meeting_id'; $objToReturn->intClassMeetingId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'class_grade_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_grade_id'] : $strAliasPrefix . 'class_grade_id'; $objToReturn->intClassGradeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'childcare_notes', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'childcare_notes'] : $strAliasPrefix . 'childcare_notes'; $objToReturn->strChildcareNotes = $objDbRow->GetColumn($strAliasName, '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 = 'class_registration__'; } // Check for SignupEntry Early Binding $strAlias = $strAliasPrefix . 'signup_entry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objSignupEntry = SignupEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signup_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassMeeting Early Binding $strAlias = $strAliasPrefix . 'class_meeting_id__signup_form_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassMeeting = ClassMeeting::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_meeting_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassGrade Early Binding $strAlias = $strAliasPrefix . 'class_grade_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objClassGrade = ClassGrade::InstantiateDbRow($objDbRow, $strAliasPrefix . 'class_grade_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ClassAttendence Virtual Binding $strAlias = $strAliasPrefix . 'classattendence__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objClassAttendenceArray[] = ClassAttendence::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classattendence__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objClassAttendence = ClassAttendence::InstantiateDbRow($objDbRow, $strAliasPrefix . 'classattendence__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a Manufacturer from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Manufacturer::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 Manufacturer */ 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 . 'manufacturer_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intManufacturerId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'manufacturer__'; } $strAlias = $strAliasPrefix . 'assetmodel__asset_model_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->_objAssetModelArray)) { $objPreviousChildItem = $objPreviousItem->_objAssetModelArray[$intPreviousChildItemCount - 1]; $objChildItem = AssetModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assetmodel__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objAssetModelArray[] = $objChildItem; } } else { $objPreviousItem->_objAssetModelArray[] = AssetModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assetmodel__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'inventorymodel__inventory_model_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->_objInventoryModelArray)) { $objPreviousChildItem = $objPreviousItem->_objInventoryModelArray[$intPreviousChildItemCount - 1]; $objChildItem = InventoryModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorymodel__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objInventoryModelArray[] = $objChildItem; } } else { $objPreviousItem->_objInventoryModelArray[] = InventoryModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorymodel__', $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 == 'manufacturer__') { $strAliasPrefix = null; } } } // Create a new instance of the Manufacturer object $objToReturn = new Manufacturer(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'manufacturer_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'manufacturer_id'] : $strAliasPrefix . 'manufacturer_id'; $objToReturn->intManufacturerId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description'; $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'long_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'long_description'] : $strAliasPrefix . 'long_description'; $objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'image_path', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_path'] : $strAliasPrefix . 'image_path'; $objToReturn->strImagePath = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by'; $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date'; $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by'; $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date'; $objToReturn->strModifiedDate = $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 = 'manufacturer__'; } // Check for CreatedByObject Early Binding $strAlias = $strAliasPrefix . 'created_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ModifiedByObject Early Binding $strAlias = $strAliasPrefix . 'modified_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ManufacturerCustomFieldHelper Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'manufacturercustomfieldhelper__manufacturer_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objManufacturerCustomFieldHelper = ManufacturerCustomFieldHelper::InstantiateDbRow($objDbRow, $strAliasPrefix . 'manufacturercustomfieldhelper__', $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->objManufacturerCustomFieldHelper = false; } } // Check for AssetModel Virtual Binding $strAlias = $strAliasPrefix . 'assetmodel__asset_model_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objAssetModelArray[] = AssetModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assetmodel__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objAssetModel = AssetModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'assetmodel__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for InventoryModel Virtual Binding $strAlias = $strAliasPrefix . 'inventorymodel__inventory_model_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objInventoryModelArray[] = InventoryModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorymodel__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objInventoryModel = InventoryModel::InstantiateDbRow($objDbRow, $strAliasPrefix . 'inventorymodel__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a Household from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Household::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 Household */ 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 = 'household__'; } $strAlias = $strAliasPrefix . 'address__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->_objAddressArray)) { $objPreviousChildItem = $objPreviousItem->_objAddressArray[$intPreviousChildItemCount - 1]; $objChildItem = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objAddressArray[] = $objChildItem; } } else { $objPreviousItem->_objAddressArray[] = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'householdparticipation__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->_objHouseholdParticipationArray)) { $objPreviousChildItem = $objPreviousItem->_objHouseholdParticipationArray[$intPreviousChildItemCount - 1]; $objChildItem = HouseholdParticipation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdparticipation__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objHouseholdParticipationArray[] = $objChildItem; } } else { $objPreviousItem->_objHouseholdParticipationArray[] = HouseholdParticipation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdparticipation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'householdsplitassplit__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->_objHouseholdSplitAsSplitArray)) { $objPreviousChildItem = $objPreviousItem->_objHouseholdSplitAsSplitArray[$intPreviousChildItemCount - 1]; $objChildItem = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplitassplit__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objHouseholdSplitAsSplitArray[] = $objChildItem; } } else { $objPreviousItem->_objHouseholdSplitAsSplitArray[] = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplitassplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'householdsplit__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->_objHouseholdSplitArray)) { $objPreviousChildItem = $objPreviousItem->_objHouseholdSplitArray[$intPreviousChildItemCount - 1]; $objChildItem = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplit__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objHouseholdSplitArray[] = $objChildItem; } } else { $objPreviousItem->_objHouseholdSplitArray[] = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'parentpagerhousehold__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->_objParentPagerHouseholdArray)) { $objPreviousChildItem = $objPreviousItem->_objParentPagerHouseholdArray[$intPreviousChildItemCount - 1]; $objChildItem = ParentPagerHousehold::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerhousehold__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objParentPagerHouseholdArray[] = $objChildItem; } } else { $objPreviousItem->_objParentPagerHouseholdArray[] = ParentPagerHousehold::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerhousehold__', $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 == 'household__') { $strAliasPrefix = null; } } } // Create a new instance of the Household object $objToReturn = new Household(); $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 . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name'; $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'head_person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'head_person_id'] : $strAliasPrefix . 'head_person_id'; $objToReturn->intHeadPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'combined_stewardship_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'combined_stewardship_flag'] : $strAliasPrefix . 'combined_stewardship_flag'; $objToReturn->blnCombinedStewardshipFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'members', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'members'] : $strAliasPrefix . 'members'; $objToReturn->strMembers = $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 = 'household__'; } // Check for HeadPerson Early Binding $strAlias = $strAliasPrefix . 'head_person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objHeadPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'head_person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Address Virtual Binding $strAlias = $strAliasPrefix . 'address__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objAddressArray[] = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objAddress = Address::InstantiateDbRow($objDbRow, $strAliasPrefix . 'address__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for HouseholdParticipation Virtual Binding $strAlias = $strAliasPrefix . 'householdparticipation__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objHouseholdParticipationArray[] = HouseholdParticipation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdparticipation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objHouseholdParticipation = HouseholdParticipation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdparticipation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for HouseholdSplitAsSplit Virtual Binding $strAlias = $strAliasPrefix . 'householdsplitassplit__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objHouseholdSplitAsSplitArray[] = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplitassplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objHouseholdSplitAsSplit = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplitassplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for HouseholdSplit Virtual Binding $strAlias = $strAliasPrefix . 'householdsplit__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objHouseholdSplitArray[] = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objHouseholdSplit = HouseholdSplit::InstantiateDbRow($objDbRow, $strAliasPrefix . 'householdsplit__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for ParentPagerHousehold Virtual Binding $strAlias = $strAliasPrefix . 'parentpagerhousehold__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objParentPagerHouseholdArray[] = ParentPagerHousehold::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerhousehold__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objParentPagerHousehold = ParentPagerHousehold::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parentpagerhousehold__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a Marriage from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Marriage::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 Marriage */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the Marriage object $objToReturn = new Marriage(); $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 . 'linked_marriage_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'linked_marriage_id'] : $strAliasPrefix . 'linked_marriage_id'; $objToReturn->intLinkedMarriageId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'married_to_person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'married_to_person_id'] : $strAliasPrefix . 'married_to_person_id'; $objToReturn->intMarriedToPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'marriage_status_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'marriage_status_type_id'] : $strAliasPrefix . 'marriage_status_type_id'; $objToReturn->intMarriageStatusTypeId = $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'); // 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 = 'marriage__'; } // Check for LinkedMarriage Early Binding $strAlias = $strAliasPrefix . 'linked_marriage_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objLinkedMarriage = Marriage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'linked_marriage_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for MarriedToPerson Early Binding $strAlias = $strAliasPrefix . 'married_to_person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objMarriedToPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'married_to_person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for MarriageAsLinked Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'marriageaslinked__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objMarriageAsLinked = Marriage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'marriageaslinked__', $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->objMarriageAsLinked = false; } } return $objToReturn; }
/** * Instantiate a PublicLogin from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this PublicLogin::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 PublicLogin */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the PublicLogin object $objToReturn = new PublicLogin(); $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 . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'active_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'active_flag'] : $strAliasPrefix . 'active_flag'; $objToReturn->blnActiveFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'username', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'username'] : $strAliasPrefix . 'username'; $objToReturn->strUsername = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'password', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'password'] : $strAliasPrefix . 'password'; $objToReturn->strPassword = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'lost_password_question', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'lost_password_question'] : $strAliasPrefix . 'lost_password_question'; $objToReturn->strLostPasswordQuestion = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'lost_password_answer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'lost_password_answer'] : $strAliasPrefix . 'lost_password_answer'; $objToReturn->strLostPasswordAnswer = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'temporary_password_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'temporary_password_flag'] : $strAliasPrefix . 'temporary_password_flag'; $objToReturn->blnTemporaryPasswordFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'date_registered', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_registered'] : $strAliasPrefix . 'date_registered'; $objToReturn->dttDateRegistered = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_last_login', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_last_login'] : $strAliasPrefix . 'date_last_login'; $objToReturn->dttDateLastLogin = $objDbRow->GetColumn($strAliasName, 'DateTime'); // 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 = 'public_login__'; } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ProvisionalPublicLogin Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'provisionalpubliclogin__public_login_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objProvisionalPublicLogin = ProvisionalPublicLogin::InstantiateDbRow($objDbRow, $strAliasPrefix . 'provisionalpubliclogin__', $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->objProvisionalPublicLogin = false; } } return $objToReturn; }
/** * Instantiate a RoleEntityQtypeBuiltInAuthorization from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this RoleEntityQtypeBuiltInAuthorization::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 RoleEntityQtypeBuiltInAuthorization */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the RoleEntityQtypeBuiltInAuthorization object $objToReturn = new RoleEntityQtypeBuiltInAuthorization(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'role_entity_built_in_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_entity_built_in_id'] : $strAliasPrefix . 'role_entity_built_in_id'; $objToReturn->intRoleEntityBuiltInId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'role_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'role_id'] : $strAliasPrefix . 'role_id'; $objToReturn->intRoleId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'entity_qtype_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'entity_qtype_id'] : $strAliasPrefix . 'entity_qtype_id'; $objToReturn->intEntityQtypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'authorization_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorization_id'] : $strAliasPrefix . 'authorization_id'; $objToReturn->intAuthorizationId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'authorized_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorized_flag'] : $strAliasPrefix . 'authorized_flag'; $objToReturn->blnAuthorizedFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by'; $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date'; $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by'; $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date'; $objToReturn->strModifiedDate = $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 = 'role_entity_qtype_built_in_authorization__'; } // Check for Role Early Binding $strAlias = $strAliasPrefix . 'role_id__role_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objRole = Role::InstantiateDbRow($objDbRow, $strAliasPrefix . 'role_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for Authorization Early Binding $strAlias = $strAliasPrefix . 'authorization_id__authorization_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objAuthorization = Authorization::InstantiateDbRow($objDbRow, $strAliasPrefix . 'authorization_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CreatedByObject Early Binding $strAlias = $strAliasPrefix . 'created_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ModifiedByObject Early Binding $strAlias = $strAliasPrefix . 'modified_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a Notification from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this Notification::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 Notification */ 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 . 'notification_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($strExpandAsArrayNodes && $objPreviousItem && $objPreviousItem->intNotificationId == $objDbRow->GetColumn($strAliasName, 'Integer')) { // We are. Now, prepare to check for ExpandAsArray clauses $blnExpandedViaArray = false; if (!$strAliasPrefix) { $strAliasPrefix = 'notification__'; } $strAlias = $strAliasPrefix . 'notificationuseraccount__notification_user_account_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->_objNotificationUserAccountArray)) { $objPreviousChildItem = $objPreviousItem->_objNotificationUserAccountArray[$intPreviousChildItemCount - 1]; $objChildItem = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objNotificationUserAccountArray[] = $objChildItem; } } else { $objPreviousItem->_objNotificationUserAccountArray[] = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $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 == 'notification__') { $strAliasPrefix = null; } } } // Create a new instance of the Notification object $objToReturn = new Notification(); $objToReturn->__blnRestored = true; $strAliasName = array_key_exists($strAliasPrefix . 'notification_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'notification_id'] : $strAliasPrefix . 'notification_id'; $objToReturn->intNotificationId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'short_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'short_description'] : $strAliasPrefix . 'short_description'; $objToReturn->strShortDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'long_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'long_description'] : $strAliasPrefix . 'long_description'; $objToReturn->strLongDescription = $objDbRow->GetColumn($strAliasName, 'Blob'); $strAliasName = array_key_exists($strAliasPrefix . 'criteria', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'criteria'] : $strAliasPrefix . 'criteria'; $objToReturn->strCriteria = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'frequency', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'frequency'] : $strAliasPrefix . 'frequency'; $objToReturn->strFrequency = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'enabled_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'enabled_flag'] : $strAliasPrefix . 'enabled_flag'; $objToReturn->blnEnabledFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'created_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'created_by'] : $strAliasPrefix . 'created_by'; $objToReturn->intCreatedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date'; $objToReturn->dttCreationDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_by', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_by'] : $strAliasPrefix . 'modified_by'; $objToReturn->intModifiedBy = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'modified_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'modified_date'] : $strAliasPrefix . 'modified_date'; $objToReturn->strModifiedDate = $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 = 'notification__'; } // Check for CreatedByObject Early Binding $strAlias = $strAliasPrefix . 'created_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreatedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'created_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ModifiedByObject Early Binding $strAlias = $strAliasPrefix . 'modified_by__user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objModifiedByObject = UserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'modified_by__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for NotificationUserAccount Virtual Binding $strAlias = $strAliasPrefix . 'notificationuseraccount__notification_user_account_id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objNotificationUserAccountArray[] = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objNotificationUserAccount = NotificationUserAccount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'notificationuseraccount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } return $objToReturn; }
/** * Instantiate a SignupPayment from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this SignupPayment::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 SignupPayment */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the SignupPayment object $objToReturn = new SignupPayment(); $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 . 'signup_entry_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_entry_id'] : $strAliasPrefix . 'signup_entry_id'; $objToReturn->intSignupEntryId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'signup_payment_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'signup_payment_type_id'] : $strAliasPrefix . 'signup_payment_type_id'; $objToReturn->intSignupPaymentTypeId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'transaction_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_date'] : $strAliasPrefix . 'transaction_date'; $objToReturn->dttTransactionDate = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'transaction_description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_description'] : $strAliasPrefix . 'transaction_description'; $objToReturn->strTransactionDescription = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'amount', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount'] : $strAliasPrefix . 'amount'; $objToReturn->fltAmount = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'funding_account', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'funding_account'] : $strAliasPrefix . 'funding_account'; $objToReturn->strFundingAccount = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'donation_stewardship_fund_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'donation_stewardship_fund_id'] : $strAliasPrefix . 'donation_stewardship_fund_id'; $objToReturn->intDonationStewardshipFundId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'amount_donation', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount_donation'] : $strAliasPrefix . 'amount_donation'; $objToReturn->fltAmountDonation = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'amount_non_donation', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount_non_donation'] : $strAliasPrefix . 'amount_non_donation'; $objToReturn->fltAmountNonDonation = $objDbRow->GetColumn($strAliasName, 'Float'); $strAliasName = array_key_exists($strAliasPrefix . 'credit_card_payment_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'credit_card_payment_id'] : $strAliasPrefix . 'credit_card_payment_id'; $objToReturn->intCreditCardPaymentId = $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 = 'signup_payment__'; } // Check for SignupEntry Early Binding $strAlias = $strAliasPrefix . 'signup_entry_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objSignupEntry = SignupEntry::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signup_entry_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for DonationStewardshipFund Early Binding $strAlias = $strAliasPrefix . 'donation_stewardship_fund_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objDonationStewardshipFund = StewardshipFund::InstantiateDbRow($objDbRow, $strAliasPrefix . 'donation_stewardship_fund_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CreditCardPayment Early Binding $strAlias = $strAliasPrefix . 'credit_card_payment_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreditCardPayment = CreditCardPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'credit_card_payment_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a HeadShot from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this HeadShot::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 HeadShot */ public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) { // If blank row, return null if (!$objDbRow) { return null; } // Create a new instance of the HeadShot object $objToReturn = new HeadShot(); $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 . 'person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'person_id'] : $strAliasPrefix . 'person_id'; $objToReturn->intPersonId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'date_uploaded', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_uploaded'] : $strAliasPrefix . 'date_uploaded'; $objToReturn->dttDateUploaded = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'image_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_type_id'] : $strAliasPrefix . 'image_type_id'; $objToReturn->intImageTypeId = $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 = 'head_shot__'; } // Check for Person Early Binding $strAlias = $strAliasPrefix . 'person_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for PersonAsCurrent Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'personascurrent__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objPersonAsCurrent = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'personascurrent__', $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->objPersonAsCurrent = false; } } return $objToReturn; }