function parent($new = null, $return_entity = false)
    {
        if (isset($new)){
            if ($new instanceof Entity){
                $this->_parent = $new;
                $new = $new->uri();
            }else{
                $this->_parent = null; // for reloading
            }
            if ($new != $this->_attributes['parent']){
                $this->change('parent', $new);
                $this->change('order', Entity::MAX_ORDER);
                $this->change('uri', $new.'/'.$this->_attributes['name']);
            }
        }
        if ($return_entity){
            if (!isset($this->_parent)){
                if (isset($this->_attributes['parent'])){
                    $this->_parent = Data::read($this->_attributes['parent']);
                }else{
                    $this->_parent = false;
                }
            }
            return $this->_parent;
        }
        return $this->_attributes['parent'];
    }
function parent($new = null, $return_entity = false)
    {
        if (isset($new)){
            if ($new instanceof Entity){
                $this->_parent = $new;
                $new = $new->uri();
            }else{
                $this->_parent = null; // for reloading
            }
            if ($new != $this->_attributes['parent']){
                $this->change('parent', $new);
                $this->change('order', Entity::MAX_ORDER);
                $this->change('uri', $new.'/'.$this->_attributes['name']);
            }
        }
        if ($return_entity){
            if (!isset($this->_parent)){
                if (isset($this->_attributes['parent'])){
                    $this->_parent = Data::read($this->_attributes['parent']);
                }else{
                    $this->_parent = false;
                }
            }
            return $this->_parent;
        }
        return $this->_attributes['parent'];
    }
function parent ( $ new = null , $ return_entity = false ) { if ( isset ( $ new ) ) { if ( $ new instanceof Entity ) { $ this -> _parent = $ new ; $ new = $ new -> uri ( ) ; } else { $ this -> _parent = null ; // for reloading } if ( $ new != $ this -> _attributes [ 'parent' ] ) { $ this -> change ( 'parent' , $ new ) ; $ this -> change ( 'order' , Entity :: MAX_ORDER ) ; $ this -> change ( 'uri' , $ new . '/' . $ this -> _attributes [ 'name' ] ) ; } } if ( $ return_entity ) { if ( ! isset ( $ this -> _parent ) ) { if ( isset ( $ this -> _attributes [ 'parent' ] ) ) { $ this -> _parent = Data :: read ( $ this -> _attributes [ 'parent' ] ) ; } else { $ this -> _parent = false ; } } return $ this -> _parent ; } return $ this -> _attributes [ 'parent' ] ; }
Parent of this object
@param null|string|Entity $new New parent. URI or object
@param bool $return_entity Признак, возвращать объект вместо uri
@return string|Entity|false
Parent of this object