Add new fields to global filter

@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()).
2781
public function addGlobalFilters(array $fields, $recursiveMerge = false)
    {
        if (is_array($fields) && !empty($fields))
        {
            if ($recursiveMerge)
            {
                $this->filterParams = array_merge_recursive($this->filterParams, $fields);
            }
            else
            {
                $this->filterParams = array_merge($this->filterParams, $fields);
            }

            $this->addCacheAdditionalId($fields);
        }
    }
496758
public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self
    {
        if ($recursive === true) {
            $result = \array_replace_recursive($this->getArray(), $array);
        } else {
            $result = \array_replace($this->getArray(), $array);
        }

        return static::create(
            $result,
            $this->iteratorClass,
            false
        );
    }
258957
public function getGroupNames($recursive = false)
    {
        $fields = [$this->schema->commonName(), $this->schema->memberOf()];

        $names = $this->getGroups($fields, $recursive)->map(function (Group $group) {
            return $group->getCommonName();
        })->toArray();

        return array_unique($names);
    }
592395
protected function getMergeFieldsMap($fields = [])
    {
        $data = ArrayData::create([]);

        foreach ($fields as $field) {
            $data->setField($field->Name, DBField::create_field('Text', $field->Value));
        }

        return $data;
    }
903739
public function addFields(array $fields)
    {
        $fields = Helpers\Validate::arrToLower($fields);

        Helpers\Validate::types(array_values($fields));

        $schema = $this->schema();
        $fields = array_diff_assoc($fields, $schema);

        if (!empty($fields))
        {
            $config         = $this->config();
            $config->schema = array_merge($schema, $fields);

            $data = $this->getData();
            foreach ($data as $key => $object)
            {
                foreach ($fields as $name => $type)
                {
                    if (Helpers\Validate::isNumeric($type))
                        $data[$key]->{$name} = 0;
                    else
                        $data[$key]->{$name} = null;
                }
            }

            Helpers\Data::table($this->name)->put($data);
            Helpers\Config::table($this->name)->put($config);
        }
    }
529466
public function addFields($fields)
    {
        if ($fields instanceof FieldsBuilder) {
            $builder = clone $fields;
            $fields = $builder->getFields();
        }

        foreach ($fields as $field) {
            $this->getFieldManager()->pushField($field);
        }

        return $this;
    }
428052
public function fields($fields)
    {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->fields = array_merge($this->fields, $fields);

        return $this;
    }
729799
public function addParamsGrouping($fields = [])
    {
        if (is_array($fields) && !empty($fields))
        {
            $this->groupingParams = array_merge(is_array($this->groupingParams) ? $this->groupingParams : [], $fields);
        }
    }
152637
public function addFields($fields)
    {
        if (!is_array($fields)) {
            $fields = array_map(function ($f) {
                return trim($f);
            }, explode(',', $fields));
        }

        $this->fields = array_merge($this->fields, $fields);

        return $this;
    }
1269895
protected function saveOriginalFieldNames(array $fields, string $field): void
	{
		foreach($fields as $expanded)
		{
			$this->originalFieldNames[$expanded] = $field;
		}
	}
1353034
public static function recursiveMerge(...$arrays)
    {
        $merged = array ();
        foreach($arrays as $array)
        {
            if (!is_array($array))
            {
                continue;
            }
            foreach ( $array as $key => $value )
            {
                if (is_string ( $key ))
                {
                    if (is_array ( $value ) && isset($merged[$key]) && is_array ( $merged [$key] ))
                    {
                        $merged [$key] = static::recursiveMerge ( $merged [$key], $value );
                    }
                    else
                    {
                        $merged [$key] = $value;
                    }
                }
                else
                {
                    $merged [] = $value;
                }
            }
        }
        return $merged;
    }
22447
public function json($fields = array(), $recursive = true)
    {
        $list = array();
        foreach ($this->getModels() as $model) {
            $list[] = $model->json($fields, $recursive);
        }
        return $list;
    }
63680
protected function deep_merge_recursive($arrays)
    {
        $result = array();

        foreach ($arrays as $array)
        {
            foreach ($array as $key => $value)
            {
                if (is_integer($key))
                {
                    $result[] = $value;
                }
                elseif (isset($result[$key]) && is_array($result[$key]) && is_array($value))
                {
                    $result[$key] = $this->deep_merge_recursive(array($result[$key], $value));
                }
                // handle embeded object with object value
                elseif (isset($result[$key]) && is_object($result[$key]) && is_object($value))
                {
                    $result[$key] = (object)$this->deep_merge_recursive(array((array)$result[$key], (array)$value));
                }
                // handle embeded object with array value
                elseif (isset($result[$key]) && is_object($result[$key]) && is_array($value))
                {
                    $result[$key] = (object)$this->deep_merge_recursive(array((array)$result[$key], $value));
                }
                else
                {
                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }
570487
public function make($data, $filters, $recursive = true)
	{
		$this->data 		= $data;
		$this->filters 		= $this->explodeFilters($filters);
		$this->recursive 	= $recursive;
		$this->filteredData	= array();

		return $this;
	}
1062067
public function addMetaField(array $fields)
    {
        $fields = parent::addMetaField($fields);
        foreach ($fields as $key => &$field) {
            if ($field['type'] === 'fieldset') {
                $field['fields'][static::Meta] = $fields[static::Meta];
                unset($fields[static::Meta]);
                break;
            }
        }
        return $fields;
    }
721112
public function addFields(array $fields)
    {
        $fields = Validate::arrToLower($fields);
        Validate::types(array_values($fields));
        $fields = array_diff_assoc($fields, $this->schema());
        if (!empty($fields))
        {
            $config         = $this->getConfig();
            $config->schema = array_merge($this->schema(), $fields);
            $data = $this->getData();
            foreach ($data as $key => $object)
            {
                foreach($fields as $name => $type)
                    $data[$key]->{$name} = (Validate::isNumeric($type)) ? 0 : null;
            }
            $this->databaseDocument->put($data);
            $this->databaseConfig->put($config);
        }
        return true;
    }
589660
public function setFields($fields = [], bool $all = false)
    {
        if (!is_array($fields) && !$fields instanceof \Traversable) {
            return $this;
        }

        foreach ($fields as $name => $value) {
            if ($all || $this->isFillable($name)) {
                try {
                    $this->setField($name, $value, true);
                } catch (AccessExceptionInterface $e) {
                    //We are suppressing field setting exceptions
                }
            }
        }

        return $this;
    }