本文整理汇总了PHP中DBObjectSearch::GetClassAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObjectSearch::GetClassAlias方法的具体用法?PHP DBObjectSearch::GetClassAlias怎么用?PHP DBObjectSearch::GetClassAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectSearch
的用法示例。
在下文中一共展示了DBObjectSearch::GetClassAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDescription
/**
* Describe (as a text string) the modifications corresponding to this change
*/
public function GetDescription()
{
$sResult = '';
$oTargetObjectClass = $this->Get('objclass');
$oTargetObjectKey = $this->Get('objkey');
$oTargetSearch = new DBObjectSearch($oTargetObjectClass);
$oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
$oMonoObjectSet = new DBObjectSet($oTargetSearch);
if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) {
if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) {
return '';
}
// Protects against renamed attributes...
$oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
$sAttName = $oAttDef->GetLabel();
$sLinkClass = $oAttDef->GetLinkedClass();
$aLinkClasses = MetaModel::EnumChildClasses($sLinkClass, ENUM_CHILD_CLASSES_ALL);
// Search for changes on the corresponding link
//
$oSearch = new DBObjectSearch('CMDBChangeOpSetAttribute');
$oSearch->AddCondition('change', $this->Get('change'), '=');
$oSearch->AddCondition('objkey', $this->Get('link_id'), '=');
if (count($aLinkClasses) == 1) {
// Faster than the whole building of the expression below for just one value ??
$oSearch->AddCondition('objclass', $sLinkClass, '=');
} else {
$oField = new FieldExpression('objclass', $oSearch->GetClassAlias());
$sListExpr = '(' . implode(', ', CMDBSource::Quote($aLinkClasses)) . ')';
$sOQLCondition = $oField->Render() . " IN {$sListExpr}";
$oNewCondition = Expression::FromOQL($sOQLCondition);
$oSearch->AddConditionExpression($oNewCondition);
}
$oSet = new DBObjectSet($oSearch);
$aChanges = array();
while ($oChangeOp = $oSet->Fetch()) {
$aChanges[] = $oChangeOp->GetDescription();
}
if (count($aChanges) == 0) {
return '';
}
$sItemDesc = MetaModel::GetHyperLink($this->Get('item_class'), $this->Get('item_id'));
$sResult = $sAttName . ' - ';
$sResult .= Dict::Format('Change:LinkSet:Modified', $sItemDesc);
$sResult .= ' : ' . implode(', ', $aChanges);
}
return $sResult;
}
示例2: DBObjectSearch
$oFilter = new DBObjectSearch($sClassName);
$aParams = array();
foreach ($aFullTextNeedles as $sSearchText) {
$oFilter->AddCondition_FullText($sSearchText);
}
}
// Skip abstract classes
if (MetaModel::IsAbstract($sClassName)) {
continue;
}
if ($iTune > 0) {
$fStartedClass = microtime(true);
}
$oSet = new DBObjectSet($oFilter, array(), $aParams);
if (array_key_exists($sClassName, $aAccelerators) && array_key_exists('attributes', $aAccelerators[$sClassName])) {
$oSet->OptimizeColumnLoad(array($oFilter->GetClassAlias() => $aAccelerators[$sClassName]['attributes']));
}
$sFullTextJS = addslashes($sFullText);
$bEnableEnlarge = array_key_exists($sClassName, $aAccelerators) && array_key_exists('query', $aAccelerators[$sClassName]);
if (array_key_exists($sClassName, $aAccelerators) && array_key_exists('enable_enlarge', $aAccelerators[$sClassName])) {
$bEnableEnlarge &= $aAccelerators[$sClassName]['enable_enlarge'];
}
$sEnlargeTheSearch = <<<EOF
\t\t\t\$('.search-class-{$sClassName} button').attr('disabled', 'disabled');
\t\t\t\$('.search-class-{$sClassName} h2').append(' <img id="indicator" src="../images/indicator.gif">');
\t\t\tvar oParams = {operation: 'full_text_search_enlarge', class: '{$sClassName}', text: '{$sFullTextJS}'};
\t\t\t\$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function(data) {
\t\t\t\t\$('.search-class-{$sClassName}').html(data);
\t\t\t});
EOF;
示例3: MakeSelectQuery
public static function MakeSelectQuery(DBObjectSearch $oFilter, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false)
{
// Check the order by specification, and prefix with the class alias
// and make sure that the ordering columns are going to be selected
//
$sClass = $oFilter->GetClass();
$sClassAlias = $oFilter->GetClassAlias();
$aOrderSpec = array();
foreach ($aOrderBy as $sFieldAlias => $bAscending) {
if ($sFieldAlias != 'id') {
MyHelpers::CheckValueInArray('field name in ORDER BY spec', $sFieldAlias, self::GetAttributesList($sClass));
}
if (!is_bool($bAscending)) {
throw new CoreException("Wrong direction in ORDER BY spec, found '{$bAscending}' and expecting a boolean value");
}
if (self::IsValidAttCode($sClass, $sFieldAlias)) {
$oAttDef = self::GetAttributeDef($sClass, $sFieldAlias);
foreach ($oAttDef->GetOrderBySQLExpressions($sClassAlias) as $sSQLExpression) {
$aOrderSpec[$sSQLExpression] = $bAscending;
}
} else {
$aOrderSpec['`' . $sClassAlias . $sFieldAlias . '`'] = $bAscending;
}
// Make sure that the columns used for sorting are present in the loaded columns
if (!is_null($aAttToLoad) && !isset($aAttToLoad[$sClassAlias][$sFieldAlias])) {
$aAttToLoad[$sClassAlias][$sFieldAlias] = MetaModel::GetAttributeDef($sClass, $sFieldAlias);
}
}
$oSelect = self::MakeSelectStructure($oFilter, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount);
$aScalarArgs = array_merge(self::PrepareQueryArguments($aArgs), $oFilter->GetInternalParams());
try {
$bBeautifulSQL = self::$m_bTraceQueries || self::$m_bDebugQuery || self::$m_bIndentQueries;
$sRes = $oSelect->RenderSelect($aOrderSpec, $aScalarArgs, $iLimitCount, $iLimitStart, $bGetCount, $bBeautifulSQL);
if ($sClassAlias == '_itop_') {
echo $sRes . "<br/>\n";
}
} catch (MissingQueryArgument $e) {
// Add some information...
$e->addInfo('OQL', $oFilter->ToOQL());
throw $e;
}
self::AddQueryTraceSelect($oFilter, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $sRes);
return $sRes;
}