/** * 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 `class_variable` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`id` AS `%s__%s__id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`qcodo_class_id` AS `%s__%s__qcodo_class_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`variable_group_id` AS `%s__%s__variable_group_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`protection_type_id` AS `%s__%s__protection_type_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`variable_id` AS `%s__%s__variable_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`read_only_flag` AS `%s__%s__read_only_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`static_flag` AS `%s__%s__static_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'qcodo_class_id': try { QcodoClass::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'variable_group_id': try { VariableGroup::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'variable_id': try { Variable::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 `parameter` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`id` AS `%s__%s__id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`operation_id` AS `%s__%s__operation_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`order_number` AS `%s__%s__order_number`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`variable_id` AS `%s__%s__variable_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`reference_flag` AS `%s__%s__reference_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'operation_id': try { Operation::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'variable_id': try { Variable::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 `operation` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`id` AS `%s__%s__id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`qcodo_class_id` AS `%s__%s__qcodo_class_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`qcodo_interface_id` AS `%s__%s__qcodo_interface_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`name` AS `%s__%s__name`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`protection_type_id` AS `%s__%s__protection_type_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`static_flag` AS `%s__%s__static_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`abstract_flag` AS `%s__%s__abstract_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`final_flag` AS `%s__%s__final_flag`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`return_variable_id` AS `%s__%s__return_variable_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`additional_variable_id` AS `%s__%s__additional_variable_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`first_version` AS `%s__%s__first_version`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`last_version` AS `%s__%s__last_version`', $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`.`extended_description` AS `%s__%s__extended_description`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`file_id` AS `%s__%s__file_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias)); $strParentAlias = $strParentAlias . '__' . $strAlias; } if (is_array($objExpansionMap)) { foreach ($objExpansionMap as $strKey => $objValue) { switch ($strKey) { case 'qcodo_class_id': try { QcodoClass::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'qcodo_interface_id': try { QcodoInterface::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'return_variable_id': try { Variable::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'additional_variable_id': try { Variable::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'file_id': try { File::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)); } } } }