/** * Instantiate a ParentPagerAttendantHistory from a Database Row. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow * is calling this ParentPagerAttendantHistory::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 ParentPagerAttendantHistory */ 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 ParentPagerAttendantHistory object $objToReturn = new ParentPagerAttendantHistory(); $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_station_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_station_id'] : $strAliasPrefix . 'parent_pager_station_id'; $objToReturn->intParentPagerStationId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'parent_pager_period_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_period_id'] : $strAliasPrefix . 'parent_pager_period_id'; $objToReturn->intParentPagerPeriodId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'parent_pager_program_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'parent_pager_program_id'] : $strAliasPrefix . 'parent_pager_program_id'; $objToReturn->intParentPagerProgramId = $objDbRow->GetColumn($strAliasName, 'Integer'); $strAliasName = array_key_exists($strAliasPrefix . 'date_in', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_in'] : $strAliasPrefix . 'date_in'; $objToReturn->dttDateIn = $objDbRow->GetColumn($strAliasName, 'DateTime'); $strAliasName = array_key_exists($strAliasPrefix . 'date_out', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_out'] : $strAliasPrefix . 'date_out'; $objToReturn->dttDateOut = $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 = 'parent_pager_attendant_history__'; } // 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 ParentPagerStation Early Binding $strAlias = $strAliasPrefix . 'parent_pager_station_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objParentPagerStation = ParentPagerStation::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_pager_station_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ParentPagerPeriod Early Binding $strAlias = $strAliasPrefix . 'parent_pager_period_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objParentPagerPeriod = ParentPagerPeriod::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_pager_period_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } // Check for ParentPagerProgram Early Binding $strAlias = $strAliasPrefix . 'parent_pager_program_id__id'; $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias; if (!is_null($objDbRow->GetColumn($strAliasName))) { $objToReturn->objParentPagerProgram = ParentPagerProgram::InstantiateDbRow($objDbRow, $strAliasPrefix . 'parent_pager_program_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray); } return $objToReturn; }
/** * Instantiate a single ParentPagerProgram 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 ParentPagerProgram 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 ParentPagerProgram::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray); }