Process values before adding to a ManyCollection.
@param  Entity  $entity
@param  string  $name
@param  mixed   $value
@param  string  $locale
@param  boolean $hook             True to enable hooks.
@param boolean  $silentException
779842
public function processPreAdd($entity, $name, &$value, $locale=null, $hook=true, $silentException=false) {
		if($hook)
			$this->trigger('set', [$entity, $name, &$value, $locale]);

		if(!$this->hasProperty($name))
			return;

		if($this->property($name)->get('hooks.set')) {
			$hook  = $this->property($name)->get('hooks.set');
			$value = call_user_func_array($hook, [$value, $entity]);
		}

		$value = $this->property($name)->_doSet($value, $entity, $name, $silentException);
	}
1271243
public function setParam($name, $value): void
    {
        if (\is_array($this->params)) {
            // Arrays or objects implementing array access
            $this->params[$name] = $value;
        } else {
            // Objects
            $this->params->{$name} = $value;
        }
    }
588352
public function get($name, $locale=null, $hook=true) {
		if(!$locale)
			$locale = $this->getLocale();

		if($hook && ($res = $this->getDefinition()->trigger('get', [$this, $name, $locale])) !== null)
			return $res;

		return $this->_get($name, $locale);
	}
825729
public void addValueTo(Object value, String name) {
        getMapHelper().addValueToIn(value, name, getCurrentValues());
    }
631265
public function add(string $name, $value): void
	{
		Arr::set($this->parameters, $name, $value);
	}
975075
public function afterSave(Event $event, Entity $entity): void
    {
        $fields = array_merge([
            $this->_table->getPrimaryKey(),
            $this->getConfig('sortField'),
        ], $this->getConfig('columnScope'));
        $savedEntity = $this->_table->get($entity->get($this->_table->getPrimaryKey()), [
            'fields' => $fields,
        ]);
        $scope = $this->getConfig('scope');

        foreach ($this->getConfig('columnScope') as $column) {
            $scope[$column] = $savedEntity->get($column);
        }
        $entitySort = $savedEntity->{$this->getConfig('sortField')};
        $entityId = $entity->get($this->_table->getPrimaryKey());

        if (empty($entitySort)) {
            $nextSortValue = $this->getNextSortValue($scope);
            $this->_table->updateAll([
                $this->getConfig('sortField') => $nextSortValue,
            ], [
                $this->_table->getPrimaryKey() => $entityId,
            ]);
        } else {
            if ($entitySort < $this->__originalSortValue) {
                $currentScope = $scope;
                $currentScope[] = "{$this->getConfig('sortField')} <" . $this->__originalSortValue;
                $currentScope[] = "{$this->getConfig('sortField')} >=" . $entitySort;
                $currentScope[] = [
                    $this->_table->getPrimaryKey() . ' !=' => $entity->id,
                ];

                $query = $this->_table->query()->update();
                $query->where($currentScope);
                $query->set([
                    $this->getConfig('sortField') => $query->newExpr($this->getConfig('sortField') . ' + 1'),
                ]);
                $query->execute();
            } elseif ($entitySort > $this->__originalSortValue) {
                $currentScope = $scope;
                $currentScope[] = "{$this->getConfig('sortField')} >" . $this->__originalSortValue;
                $currentScope[] = "{$this->getConfig('sortField')} <=" . $entitySort;
                $currentScope[] = [
                    $this->_table->getPrimaryKey() . ' !=' => $entity->id,
                ];

                $query = $this->_table->query()->update();
                $query->where($currentScope);
                $query->set([
                    $this->getConfig('sortField') => $query->newExpr($this->getConfig('sortField') . ' - 1'),
                ]);
                $query->execute();
            } elseif ($entitySort == $this->__originalSortValue) {
                $currentScope = $scope;
                $currentScope[] = "{$this->getConfig('sortField')} >=" . $entitySort;
                $currentScope[] = [
                    $this->_table->getPrimaryKey() . ' !=' => $entity->id,
                ];

                $query = $this->_table->query()->update();
                $query->where($currentScope);
                $query->set([
                    $this->getConfig('sortField') => $query->newExpr($this->getConfig('sortField') . ' + 1'),
                ]);
                $query->execute();
            }
        }
        $this->__originalSortValue = null;
    }
896639
public function addPropertyValue(&$entity, $field, $value)
    {
        $container = $this->getPropertyValue($entity, $field, $entity);

        if (!is_array($container)) {
            $container = empty($container) ? [] : [$container];
        }
        $container[] = $value;

        $this->setPropertyValue($entity, $field, $container);
    }
208838
public function addGlobal($name, $value)
    {
        if ($this->extensionInitialized || $this->runtimeInitialized) {
            if (null === $this->globals) {
                $this->globals = $this->initGlobals();
            }

            /* This condition must be uncommented in Twig 2.0
            if (!array_key_exists($name, $this->globals)) {
                throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
            }
            */
        }

        if ($this->extensionInitialized || $this->runtimeInitialized) {
            // update the value
            $this->globals[$name] = $value;
        } else {
            $this->staging->addGlobal($name, $value);
        }
    }
1227269
public function iUpdateTheARecordWithTheValue(string $name, string $domain, string $value = null): void
    {
        $parameters = [
            'name' => $name,
            'domain' => $domain,
            '--value' => $value,
            '--adapter' => 'fake',
            '--params' => ['fake'],
        ];

        $input = new ArrayInput(array_filter($parameters));
        $input->setInteractive(false);

        $this->command->run($input, new NullOutput());
    }
6868
protected function setEntityAttributeValue($entity, $field, $value)
    {
        $functionName = 'set'.ucfirst($field);

        call_user_func([$entity, $functionName], $value);
    }
690613
protected function setExisting($name, $value, Environment $env, $valueUnreduced = null)
    {
        $storeEnv = $env;

        $hasNamespace = $name[0] === '^' || $name[0] === '@' || $name[0] === '%';

        for (;;) {
            if (array_key_exists($name, $env->store)) {
                break;
            }

            if (! $hasNamespace && isset($env->marker)) {
                $env = $storeEnv;
                break;
            }

            if (! isset($env->parent)) {
                $env = $storeEnv;
                break;
            }

            $env = $env->parent;
        }

        $env->store[$name] = $value;

        if ($valueUnreduced) {
            $env->storeUnreduced[$name] = $valueUnreduced;
        }
    }
54556
public static function addGlobal($name, $value = null)
    {
        if (is_array($name)) {
            foreach ($name as $variable => $value) {
                static::addGlobal($variable, $value);
            }
        } else {
            static::$engine->addGlobal($name, $value);
        }
    }
1363078
public function add_param($name, $value, $id = null) {
        if (!$id) {
            $id = $name;
        }
        $this->params[] = [
            'name' => $name,
            'value' => $value,
            'id' => $id
        ];
    }
1359840
public function hook($name, $callable, $priority = 10)
    {
        if (!isset($this->hooks[$name])) {
            $this->hooks[$name] = array(array());
        }
        if (is_callable($callable)) {
            $this->hooks[$name][(int) $priority][] = $callable;
        }
    }
3502
public void addValues(Object name, List values) 
    {
        Object lo = super.get(name);
        Object ln = LazyList.addCollection(lo,values);
        if (lo!=ln)
            super.put(name,ln);
    }
848778
protected function processRelationQuery($relation, $name, $value)
    {
        if (!$this->hasRelation($relation)) {
            return;
        }

        $this->reqJoin($relation);

        list($name, $op) = $this->parseNameAndOp($name);

        /** @var BaseModelV2 $related */
        $related = $this->$relation();
        if (!$related->hasColumn($name)) {
            return;
        }

        $this->queryByOp($related->getTable() . '.' . $name, $op, $value);
    }
514996
public function addExtraInfo($name, $value)
	{
		if (method_exists($this->_handler, 'addDataTable'))
			$this->_handler->addDataTable('Xmlnuke Debug', array($name => $value));
	}