/** * Instantiate a StewardshipFund from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this StewardshipFund::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 StewardshipFund */ 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_fund__'; } $strAlias = $strAliasPrefix . 'onlinedonationlineitem__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->_objOnlineDonationLineItemArray)) { $objPreviousChildItem = $objPreviousItem->_objOnlineDonationLineItemArray[$intPreviousChildItemCount - 1]; $objChildItem = OnlineDonationLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'onlinedonationlineitem__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objOnlineDonationLineItemArray[] = $objChildItem; } } else { $objPreviousItem->_objOnlineDonationLineItemArray[] = OnlineDonationLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'onlinedonationlineitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'recurringdonationitems__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->_objRecurringDonationItemsArray)) { $objPreviousChildItem = $objPreviousItem->_objRecurringDonationItemsArray[$intPreviousChildItemCount - 1]; $objChildItem = RecurringDonationItems::InstantiateDbRow($objDbRow, $strAliasPrefix . 'recurringdonationitems__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objRecurringDonationItemsArray[] = $objChildItem; } } else { $objPreviousItem->_objRecurringDonationItemsArray[] = RecurringDonationItems::InstantiateDbRow($objDbRow, $strAliasPrefix . 'recurringdonationitems__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'signupformasdonation__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->_objSignupFormAsDonationArray)) { $objPreviousChildItem = $objPreviousItem->_objSignupFormAsDonationArray[$intPreviousChildItemCount - 1]; $objChildItem = SignupForm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupformasdonation__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objSignupFormAsDonationArray[] = $objChildItem; } } else { $objPreviousItem->_objSignupFormAsDonationArray[] = SignupForm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupformasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'signuppaymentasdonation__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->_objSignupPaymentAsDonationArray)) { $objPreviousChildItem = $objPreviousItem->_objSignupPaymentAsDonationArray[$intPreviousChildItemCount - 1]; $objChildItem = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppaymentasdonation__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objSignupPaymentAsDonationArray[] = $objChildItem; } } else { $objPreviousItem->_objSignupPaymentAsDonationArray[] = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppaymentasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshipcontributionamount__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->_objStewardshipContributionAmountArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipContributionAmountArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipContributionAmountArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipContributionAmountArray[] = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $strAlias = $strAliasPrefix . 'stewardshippledge__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->_objStewardshipPledgeArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipPledgeArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipPledge::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippledge__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipPledgeArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipPledgeArray[] = StewardshipPledge::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippledge__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } $blnExpandedViaArray = true; } $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_fund__') { $strAliasPrefix = null; } } } // Create a new instance of the StewardshipFund object $objToReturn = new StewardshipFund(); $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 . '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 . 'external_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'external_name'] : $strAliasPrefix . 'external_name'; $objToReturn->strExternalName = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'account_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'account_number'] : $strAliasPrefix . 'account_number'; $objToReturn->strAccountNumber = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'fund_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fund_number'] : $strAliasPrefix . 'fund_number'; $objToReturn->strFundNumber = $objDbRow->GetColumn($strAliasName, 'VarChar'); $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 . 'external_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'external_flag'] : $strAliasPrefix . 'external_flag'; $objToReturn->blnExternalFlag = $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 = 'stewardship_fund__'; } // 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 OnlineDonationLineItem Virtual Binding $strAlias = $strAliasPrefix . 'onlinedonationlineitem__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objOnlineDonationLineItemArray[] = OnlineDonationLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'onlinedonationlineitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objOnlineDonationLineItem = OnlineDonationLineItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'onlinedonationlineitem__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for RecurringDonationItems Virtual Binding $strAlias = $strAliasPrefix . 'recurringdonationitems__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objRecurringDonationItemsArray[] = RecurringDonationItems::InstantiateDbRow($objDbRow, $strAliasPrefix . 'recurringdonationitems__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objRecurringDonationItems = RecurringDonationItems::InstantiateDbRow($objDbRow, $strAliasPrefix . 'recurringdonationitems__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for SignupFormAsDonation Virtual Binding $strAlias = $strAliasPrefix . 'signupformasdonation__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objSignupFormAsDonationArray[] = SignupForm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupformasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objSignupFormAsDonation = SignupForm::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signupformasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for SignupPaymentAsDonation Virtual Binding $strAlias = $strAliasPrefix . 'signuppaymentasdonation__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objSignupPaymentAsDonationArray[] = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppaymentasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objSignupPaymentAsDonation = SignupPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'signuppaymentasdonation__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipContributionAmount Virtual Binding $strAlias = $strAliasPrefix . 'stewardshipcontributionamount__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipContributionAmountArray[] = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipContributionAmount = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } } // Check for StewardshipPledge Virtual Binding $strAlias = $strAliasPrefix . 'stewardshippledge__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipPledgeArray[] = StewardshipPledge::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippledge__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipPledge = StewardshipPledge::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshippledge__', $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 single StewardshipContributionAmount 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 StewardshipContributionAmount 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 StewardshipContributionAmount::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray); }
/** * Instantiate a StewardshipContribution from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this StewardshipContribution::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 StewardshipContribution */ 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_contribution__'; } $strAlias = $strAliasPrefix . 'stewardshipcontributionamount__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->_objStewardshipContributionAmountArray)) { $objPreviousChildItem = $objPreviousItem->_objStewardshipContributionAmountArray[$intPreviousChildItemCount - 1]; $objChildItem = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray); if ($objChildItem) { $objPreviousItem->_objStewardshipContributionAmountArray[] = $objChildItem; } } else { $objPreviousItem->_objStewardshipContributionAmountArray[] = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $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_contribution__') { $strAliasPrefix = null; } } } // Create a new instance of the StewardshipContribution object $objToReturn = new StewardshipContribution(); $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 . 'stewardship_contribution_type_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'stewardship_contribution_type_id'] : $strAliasPrefix . 'stewardship_contribution_type_id'; $objToReturn->intStewardshipContributionTypeId = $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 . 'stewardship_stack_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'stewardship_stack_id'] : $strAliasPrefix . 'stewardship_stack_id'; $objToReturn->intStewardshipStackId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'checking_account_lookup_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'checking_account_lookup_id'] : $strAliasPrefix . 'checking_account_lookup_id'; $objToReturn->intCheckingAccountLookupId = $objDbRow->GetColumn($strAliasName, 'Integer'); $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 . 'date_entered', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_entered'] : $strAliasPrefix . 'date_entered'; $objToReturn->dttDateEntered = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_cleared', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_cleared'] : $strAliasPrefix . 'date_cleared'; $objToReturn->dttDateCleared = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_credited', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_credited'] : $strAliasPrefix . 'date_credited'; $objToReturn->dttDateCredited = $objDbRow->GetColumn($strAliasName, 'Date'); $strAliasName = array_key_exists($strAliasPrefix . 'check_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'check_number'] : $strAliasPrefix . 'check_number'; $objToReturn->strCheckNumber = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'authorization_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorization_number'] : $strAliasPrefix . 'authorization_number'; $objToReturn->strAuthorizationNumber = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'alternate_source', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'alternate_source'] : $strAliasPrefix . 'alternate_source'; $objToReturn->strAlternateSource = $objDbRow->GetColumn($strAliasName, 'VarChar'); $strAliasName = array_key_exists($strAliasPrefix . 'non_deductible_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'non_deductible_flag'] : $strAliasPrefix . 'non_deductible_flag'; $objToReturn->blnNonDeductibleFlag = $objDbRow->GetColumn($strAliasName, 'Bit'); $strAliasName = array_key_exists($strAliasPrefix . 'note', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'note'] : $strAliasPrefix . 'note'; $objToReturn->strNote = $objDbRow->GetColumn($strAliasName, 'Blob'); $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'); $strAliasName = array_key_exists($strAliasPrefix . 'unposted_flag', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'unposted_flag'] : $strAliasPrefix . 'unposted_flag'; $objToReturn->blnUnpostedFlag = $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 = 'stewardship_contribution__'; } // 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 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 StewardshipStack Early Binding $strAlias = $strAliasPrefix . 'stewardship_stack_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objStewardshipStack = StewardshipStack::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardship_stack_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for CheckingAccountLookup Early Binding $strAlias = $strAliasPrefix . 'checking_account_lookup_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCheckingAccountLookup = CheckingAccountLookup::InstantiateDbRow($objDbRow, $strAliasPrefix . 'checking_account_lookup_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 CreditCardPayment Unique ReverseReference Binding $strAlias = $strAliasPrefix . 'creditcardpayment__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if ($objDbRow->ColumnExists($strAliasName)) { if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objCreditCardPayment = CreditCardPayment::InstantiateDbRow($objDbRow, $strAliasPrefix . 'creditcardpayment__', $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->objCreditCardPayment = false; } } // Check for StewardshipContributionAmount Virtual Binding $strAlias = $strAliasPrefix . 'stewardshipcontributionamount__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { if ($strExpandAsArrayNodes && array_key_exists($strAlias, $strExpandAsArrayNodes)) { $objToReturn->_objStewardshipContributionAmountArray[] = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } else { $objToReturn->_objStewardshipContributionAmount = StewardshipContributionAmount::InstantiateDbRow($objDbRow, $strAliasPrefix . 'stewardshipcontributionamount__', $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; }