本文整理汇总了PHP中CustomField::ExpandQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::ExpandQuery方法的具体用法?PHP CustomField::ExpandQuery怎么用?PHP CustomField::ExpandQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::ExpandQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ExpandQuery
/**
* 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 `asset_custom_field_asset_model` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`asset_custom_field_asset_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`asset_custom_field_asset_model_id` AS `%s__%s__asset_custom_field_asset_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`asset_model_id` AS `%s__%s__asset_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`custom_field_id` AS `%s__%s__custom_field_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$strParentAlias = $strParentAlias . '__' . $strAlias;
}
if (is_array($objExpansionMap)) {
foreach ($objExpansionMap as $strKey => $objValue) {
switch ($strKey) {
case 'asset_model_id':
try {
AssetModel::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
break;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'custom_field_id':
try {
CustomField::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));
}
}
}
}
示例2: ExpandQuery
/**
* 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 `custom_field_value` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`custom_field_value_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`custom_field_value_id` AS `%s__%s__custom_field_value_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
$objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`custom_field_id` AS `%s__%s__custom_field_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`.`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 'custom_field_id':
try {
CustomField::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));
}
}
}
}