本文整理汇总了PHP中ArrayHelper::addUniqueValues方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper::addUniqueValues方法的具体用法?PHP ArrayHelper::addUniqueValues怎么用?PHP ArrayHelper::addUniqueValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper::addUniqueValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnectedDatasetNames
public function getConnectedDatasetNames($includeRoot = TRUE, $includeTransitional = TRUE) {
$datasetNames = NULL;
if ($includeRoot) {
ArrayHelper::addUniqueValue($datasetNames, $this->dataset->name);
}
ArrayHelper::addUniqueValues($datasetNames, $this->getConnectedNestedDatasetNames($includeTransitional));
return $datasetNames;
}
示例2: selectCompatible
protected function selectCompatible(array $datatypes)
{
$compatibleDataTypes = NULL;
for ($i = 0, $count = count($datatypes) - 1; $i < $count; $i++) {
$datatypeA = $datatypes[$i];
$datatypeB = $datatypes[$i + 1];
$selectedByDataTypeA = $this->getHandler($datatypeA)->selectCompatible($datatypeB);
$selectedByDataTypeB = $this->getHandler($datatypeB)->selectCompatible($datatypeA);
ArrayHelper::addUniqueValues($compatibleDataTypes, array($selectedByDataTypeA, $selectedByDataTypeB));
ArrayHelper::addUniqueValues($compatibleDataTypes, $this->selectCompatible(array_slice($datatypes, 1)));
}
return $compatibleDataTypes;
}
示例3: __construct
public function __construct(array $propertyNames = NULL, ResultFormatter $parent = NULL)
{
parent::__construct($parent);
ArrayHelper::addUniqueValues($this->propertyNames, $propertyNames);
}
示例4: cleanFunctionParameters
public static function cleanFunctionParameters($datasetName, $columns, $parameters, $orderBy, array $options = NULL) {
$metamodel = data_controller_get_metamodel();
$dataset = $metamodel->getDataset($datasetName);
$cleanedColumns = ArrayHelper::trim($columns);
$cleanedParameters = NULL;
if (isset($parameters)) {
foreach ($parameters as $key => $value) {
$key = StringHelper::trim($key);
// ignoring system parameters
list($elementNameSpace) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($key);
if (!isset($elementNameSpace)) {
continue;
}
$cleanedParameters[$key] = $value;
}
}
$cleanedOrderBy = NULL;
ArrayHelper::addUniqueValues($cleanedOrderBy, ArrayHelper::trim($orderBy));
$cleanedOptions = NULL;
if (isset($options)) {
foreach ($options as $name => $option) {
$cleanedOption = NULL;
if (isset($option)) {
if ($name == AbstractQueryRequest::OPTION__FORMULA_DEF) {
// cleaning all formulas
foreach ($option as $index => $formula) {
$cleanedFormula = clone $formula;
$parser = new FormulaExpressionParser($cleanedFormula->expressionLanguage);
$cleanedFormula->source = $parser->parse($cleanedFormula->source, 'DatasetUIMetaDataQueryHelper::cleanFormulaExpressionColumnNames');
$cleanedOption[$index] = $cleanedFormula;
}
// assembling clean formulas to calculate 'measure' flag
if (isset($cleanedOption)) {
$columnReferenceFactory = new CompositeColumnReferenceFactory(array(
$dataset,
new FormulaReferenceFactory($cleanedOption)));
$expressionAssembler = new FormulaExpressionAssembler($columnReferenceFactory);
foreach ($cleanedOption as $index => $cleanedFormula) {
// assembling full expressions to detect if any aggregation function present
$expression = $expressionAssembler->assemble($cleanedFormula);
// process the formula expression
$handler = FormulaExpressionLanguageFactory::getInstance()->getHandler($cleanedFormula->expressionLanguage);
$lexemes = $handler->lex($expression);
$syntaxTree = $handler->parse($lexemes);
// checking if the formula expression contains references to any aggregation functions
$cleanedFormula->isMeasure = $handler->isMeasure($syntaxTree);
}
}
}
elseif (is_array($option)) {
$cleanedOption = ArrayHelper::copy($option);
}
elseif (is_object($option)) {
$cleanedOption = clone $option;
}
else {
$cleanedOption = $option;
}
}
if (isset($cleanedOption)) {
$cleanedOptions[$name] = $cleanedOption;
}
}
}
// adjusting list of columns we need to return
$requestedColumnNames = NULL;
// preparing list of unique column names
ArrayHelper::addUniqueValues($requestedColumnNames, $cleanedColumns);
// adding columns which are used to sort result
if ($cleanedOrderBy) {
foreach ($cleanedOrderBy as $directionalColumnName) {
list($columnName, $isSortAscending) = ColumnBasedComparator_AbstractSortingConfiguration::parseDirectionalColumnName($directionalColumnName);
ArrayHelper::addUniqueValue($requestedColumnNames, $columnName);
}
}
return array($requestedColumnNames, $cleanedParameters, $cleanedOrderBy, $cleanedOptions);
}
示例5: optimizeLinks
protected function optimizeLinks(ReferenceLink $link) {
// removing useless transitional links
// 1) transitional link uses the same column to link with parent as its children use to connect with the link
if (isset($link->nestedLinks)) {
reset($link->nestedLinks);
while (list(, $childLink) = each($link->nestedLinks)) {
if ($childLink->required) {
continue;
}
if (!isset($childLink->nestedLinks)) {
continue;
}
foreach ($childLink->nestedLinks as $grandchildLink) {
// checking column names. Those have to be the same in order to proceed with the optimization
if (count($childLink->columnNames) !== count($grandchildLink->parentColumnNames)) {
continue;
}
// number of columns is the same. Checking column names
foreach ($childLink->columnNames as $columnName) {
if (!in_array($columnName, $grandchildLink->parentColumnNames)) {
continue 2;
}
}
$childLink->unregisterNestedLink($grandchildLink);
// ---------- updating the link to move it to grand parent node
// setting new parent
$grandchildParentColumnNames = $grandchildLink->parentColumnNames;
$grandchildLink->parentColumnNames = $childLink->parentColumnNames;
// rearranging linking columns
$grandchildColumnNames = $grandchildLink->columnNames;
$grandchildLink->columnNames = NULL;
foreach ($childLink->columnNames as $referencePointColumnIndex => $columnName) {
$grandchildReferencePointColumnIndex = array_search($columnName, $grandchildParentColumnNames);
$grandchildLink->columnNames[$referencePointColumnIndex] = $grandchildColumnNames[$grandchildReferencePointColumnIndex];
}
// combining reference names
ArrayHelper::addUniqueValues($grandchildLink->referenceNames, $childLink->referenceNames);
$link->mergeNestedLink($grandchildLink);
}
$this->optimizeLinks($childLink);
}
}
}
示例6: prepareRequest4Total
public function prepareRequest4Total(AbstractQueryRequest $request) {
$expressions = $this->collectTotalExpressions($request);
if (!isset($expressions)) {
return NULL;
}
$uniqueExpressions = NULL;
foreach ($expressions as $formulaName => $totalExpressions) {
ArrayHelper::addUniqueValues($uniqueExpressions, $totalExpressions);
}
// initializing request object
$request4Total = $this->initializeRequest4Total($request);
// preparing options
$request4Total->addOptions(ArrayHelper::copy($request->options));
// adding total expressions
$totalExpressionColumnMapping = NULL;
foreach ($uniqueExpressions as $index => $expression) {
$expressionColumnName = 'sm_total_' . $index;
$formula = new FormulaMetaData();
$formula->name = $expressionColumnName;
$formula->type->applicationType = NumberDataTypeHandler::DATA_TYPE;
$formula->source = $expression;
$request4Total->addFormula($formula);
$totalExpressionColumnMapping[$expressionColumnName] = $expression;
}
$request4Total->addOption(self::OPTION__TOTAL_FORMULA_EXPRESSION, $expressions);
$request4Total->addOption(self::OPTION__TOTAL_EXPRESSION_COLUMN_MAPPING, $totalExpressionColumnMapping);
// finalizing the request
$this->finalizeRequest4Total($request, $request4Total, array_keys($totalExpressionColumnMapping));
return $request4Total;
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:38,代码来源:AbstractTotalInFormulaExpressionRequestProcessor.php