本文整理汇总了PHP中Bitrix\Main\Entity\Query::getChains方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::getChains方法的具体用法?PHP Query::getChains怎么用?PHP Query::getChains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Entity\Query
的用法示例。
在下文中一共展示了Query::getChains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
}
unset($chFilter);
// </editor-fold>
// rewrite User SHORT_NAME
CReport::rewriteUserShortName($select, $runtime, $arParams['USER_NAME_FORMAT'], $entity);
// <editor-fold defaultstate="collapsed" desc="retrieve report rows">
call_user_func_array(array($arParams['REPORT_HELPER_CLASS'], 'beforeViewDataQuery'), array(&$select, &$filter, &$group, &$order, &$limit, &$options, &$runtime));
$main_query = new Entity\Query($entity);
$main_query->setSelect($select)->setFilter($filter)->setGroup($group)->setOrder($order);
foreach ($runtime as $k => $v) {
$main_query->registerRuntimeField($k, $v);
// add view column if needed
if (isset($v['view_column']) && is_array($v['view_column'])) {
$runtimeColumnInfo = $v['view_column'];
$newNum = max(array_keys($viewColumns)) + 1;
$queryChains = $main_query->getChains();
if (isset($queryChains[$k])) {
$runtimeField = $queryChains[$k]->getLastElement()->getValue();
if (is_array($runtimeField)) {
$runtimeField = end($runtimeField);
}
/*$arUF = CReport::detectUserField($runtimeField, $arUFInfo);*/
$viewColumns[$newNum] = array('field' => $runtimeField, 'fieldName' => $k, 'resultName' => $k, 'humanTitle' => empty($runtimeColumnInfo['humanTitle']) ? '' : $runtimeColumnInfo['humanTitle'], 'defaultSort' => '', 'aggr' => '', 'prcnt' => '', 'href' => empty($runtimeColumnInfo['href']) ? '' : $runtimeColumnInfo['href'], 'grouping' => false, 'grouping_subtotal' => $runtimeColumnInfo['grouping_subtotal'] === true ? true : false, 'runtime' => true);
/*unset($arUF);*/
$viewColumnsByResultName[$k] =& $viewColumns[$newNum];
}
}
}
if (isset($limit['nPageTop'])) {
$main_query->setLimit($limit['nPageTop']);
}
示例2: getInstanceByQuery
public static function getInstanceByQuery(Query $query, &$entity_name = null)
{
if ($entity_name === null) {
$entity_name = 'Tmp' . randString();
} elseif (!preg_match('/^[a-z0-9_]+$/i', $entity_name)) {
throw new Main\ArgumentException(sprintf('Invalid entity name `%s`.', $entity_name));
}
$query_string = '(' . $query->getQuery() . ')';
$query_chains = $query->getChains();
$replaced_aliases = array_flip($query->getReplacedAliases());
// generate fieldsMap
$fieldsMap = array('TMP_ID' => array('data_type' => 'integer', 'primary' => true));
foreach ($query->getSelect() as $k => $v) {
if (is_array($v)) {
// expression
$fieldsMap[$k] = array('data_type' => $v['data_type']);
} else {
if ($v instanceof ExpressionField) {
$fieldDefinition = $v->getName();
} else {
$fieldDefinition = is_numeric($k) ? $v : $k;
}
// better to initialize fields as objects after entity is created
$dataType = Field::getOldDataTypeByField($query_chains[$fieldDefinition]->getLastElement()->getValue());
$fieldsMap[$fieldDefinition] = array('data_type' => $dataType);
}
if (isset($replaced_aliases[$k])) {
$fieldsMap[$k]['column_name'] = $replaced_aliases[$k];
}
}
// generate class content
$eval = 'class ' . $entity_name . 'Table extends ' . __NAMESPACE__ . '\\DataManager {' . PHP_EOL;
$eval .= 'public static function getMap() {' . PHP_EOL;
$eval .= 'return ' . var_export($fieldsMap, true) . ';' . PHP_EOL;
$eval .= '}';
$eval .= 'public static function getTableName() {' . PHP_EOL;
$eval .= 'return ' . var_export($query_string, true) . ';' . PHP_EOL;
$eval .= '}';
$eval .= '}';
eval($eval);
return self::getInstance($entity_name);
}