Skip to content

Commit

Permalink
Option of recursive merge parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
niksamokhvalov committed May 7, 2015
1 parent a36470d commit 0ecc95a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/traits/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,23 @@ protected function setParamsFilters()
/**
* Add new fields to global filter
*
* @param array $fields
* @param array $fields Array with fields
* @param bool $recursiveMerge If true, $fields will be recursive merged with
* other parameters (used array_merge_recursive()), otherwise not recursive merge (used array_merge()).
*/
public function addGlobalFilters(array $fields)
public function addGlobalFilters(array $fields, $recursiveMerge = false)
{
if (is_array($fields) && !empty($fields))
{
$this->filterParams = array_merge_recursive($this->filterParams, $fields);
if ($recursiveMerge)
{
$this->filterParams = array_merge_recursive($this->filterParams, $fields);
}
else
{
$this->filterParams = array_merge($this->filterParams, $fields);
}

$this->addCacheAdditionalId($fields);
}
}
Expand Down

0 comments on commit 0ecc95a

Please sign in to comment.