/** * Internally called method to assist with early binding of objects * on load methods. Can only early-bind references that this class owns in the database. * @param string $strParentAlias the alias of the parent (if any) * @param string $strAlias the alias of this object * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding * @param QueryExpansion an already instantiated QueryExpansion object (used as a utility object to assist with object expansion) */ public static function ExpandQuery($strParentAlias, $strAlias, $objExpansionMap, QQueryExpansion $objQueryExpansion) { if ($strAlias) { $objQueryExpansion->AddFromItem(sprintf('LEFT JOIN `datagrid_column_preference` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`datagrid_column_preference_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`datagrid_column_preference_id` AS `%s__%s__datagrid_column_preference_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`datagrid_id` AS `%s__%s__datagrid_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`column_name` AS `%s__%s__column_name`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`user_account_id` AS `%s__%s__user_account_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`display_flag` AS `%s__%s__display_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'datagrid_id': try { Datagrid::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'user_account_id': try { UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } default: throw new QCallerException(sprintf('Unknown Object to Expand in %s: %s', $strParentAlias, $strKey)); } } } }