Jackalope\Node::_setProperty PHP Method

_setProperty() protected method

Implement the setProperty, but also used from constructor or in refresh, when the backend has a new property that is not yet loaded in memory.
See also: Node::setProperty
See also: Node::refresh
See also: Node::__construct
protected _setProperty ( string $name, mixed $value, string $type, boolean $internal ) : Property
$name string
$value mixed
$type string
$internal boolean whether we are setting this node through api or internally
return Property
    protected function _setProperty($name, $value, $type, $internal)
    {
        if ($name === '' || false !== strpos($name, '/')) {
            throw new InvalidArgumentException("The name '{$name}' is no valid property name");
        }
        if (!isset($this->properties[$name])) {
            $path = $this->getChildPath($name);
            $property = $this->factory->get('Property', array(array('type' => $type, 'value' => $value), $path, $this->session, $this->objectManager, !$internal));
            $this->properties[$name] = $property;
            if (!$internal) {
                $this->setModified();
            }
        } else {
            if ($internal) {
                $this->properties[$name]->_setValue($value, $type);
                if ($this->properties[$name]->isDirty()) {
                    $this->properties[$name]->setClean();
                }
            } else {
                $this->properties[$name]->setValue($value, $type);
            }
        }
        return $this->properties[$name];
    }