/** * 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 `role_entity_qtype_built_in_authorization` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`role_entity_built_in_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`role_entity_built_in_id` AS `%s__%s__role_entity_built_in_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`role_id` AS `%s__%s__role_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`entity_qtype_id` AS `%s__%s__entity_qtype_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`authorization_id` AS `%s__%s__authorization_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`authorized_flag` AS `%s__%s__authorized_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`created_by` AS `%s__%s__created_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`creation_date` AS `%s__%s__creation_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_by` AS `%s__%s__modified_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_date` AS `%s__%s__modified_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'role_id': try { Role::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'authorization_id': try { Authorization::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'created_by': try { UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'modified_by': 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)); } } } }
/** * 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 `shortcut` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`shortcut_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`shortcut_id` AS `%s__%s__shortcut_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`module_id` AS `%s__%s__module_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`authorization_id` AS `%s__%s__authorization_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`transaction_type_id` AS `%s__%s__transaction_type_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`short_description` AS `%s__%s__short_description`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`link` AS `%s__%s__link`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`image_path` AS `%s__%s__image_path`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`entity_qtype_id` AS `%s__%s__entity_qtype_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`create_flag` AS `%s__%s__create_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'module_id': try { Module::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'authorization_id': try { Authorization::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'transaction_type_id': try { TransactionType::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)); } } } }