lithium\data\entity\Document::_setNested PHP Method

_setNested() protected method

protected _setNested ( $name, $value )
    protected function _setNested($name, $value)
    {
        $current =& $this;
        $path = explode('.', $name);
        $length = count($path) - 1;
        for ($i = 0; $i < $length; $i++) {
            $key = $path[$i];
            if (isset($current[$key])) {
                $next =& $current[$key];
            } else {
                unset($next);
                $next = null;
            }
            if ($next === null && ($model = $this->_model)) {
                $current->set(array($key => $model::create(array(), array('defaults' => false))));
                $next =& $current->{$key};
            }
            $current =& $next;
        }
        if (is_object($current)) {
            $current->set(array(end($path) => $value));
        }
    }