/** * 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 ParentPagerAddress from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ParentPagerAddress::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 ParentPagerAddress */ 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 ParentPagerAddress object $objToReturn = new ParentPagerAddress(); $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 . 'parent_pager_individual_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_individual_id'] : $strAliasPrefix . 'parent_pager_individual_id'; $objToReturn->intParentPagerIndividualId = $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 . '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 . 'address_3', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'address_3'] : $strAliasPrefix . 'address_3'; $objToReturn->strAddress3 = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'city', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'city'] : $strAliasPrefix . 'city'; $objToReturn->strCity = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'state', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'state'] : $strAliasPrefix . 'state'; $objToReturn->strState = $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'); // 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_address__'; } // Check for ParentPagerIndividual Early Binding $strAlias = $strAliasPrefix . 'parent_pager_individual_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objParentPagerIndividual = ParentPagerIndividual::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_pager_individual_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); } return $objToReturn; }
/** * 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 single ParentPagerHousehold object from a query cursor (e.g. a DB ResultSet). * Cursor is automatically moved to the "next row" of the result set. * Will return NULL if no cursor or if the cursor has no more rows in the resultset. * @param QDatabaseResultBase $objDbResult cursor resource * @return ParentPagerHousehold next row resulting from the query */ public static function InstantiateCursor(QDatabaseResultBase $objDbResult) { // If blank resultset, then return empty result if (!$objDbResult) { return null; } // If empty resultset, then return empty result $objDbRow = $objDbResult->GetNextRow(); if (!$objDbRow) { return null; } // We need the Column Aliases $strColumnAliasArray = $objDbResult->QueryBuilder->ColumnAliasArray; if (!$strColumnAliasArray) { $strColumnAliasArray = array(); } // Pull Expansions (if applicable) $strExpandAsArrayNodes = $objDbResult->QueryBuilder->ExpandAsArrayNodes; // Load up the return result with a row and return it return ParentPagerHousehold::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray); }