public function setParent($parent)
    {
        if (empty($parent) || $this->getRefId() == $parent->getRefId() ||
            $parent->hasAncestor($this) || $this->hasReachedAncestorLimit()) {
            return false;
        }
        unset($this->parent);
        unset($parent->children);
        $this->trigger(static::$eventParentChanged);
        $parent->trigger(static::$eventChildAdded);
        return $this->{$this->parentAttribute} = $parent->getRefId();
    }
public function setParent($parent)
    {
        if (empty($parent) || $this->getRefId() == $parent->getRefId() ||
            $parent->hasAncestor($this) || $this->hasReachedAncestorLimit()) {
            return false;
        }
        unset($this->parent);
        unset($parent->children);
        $this->trigger(static::$eventParentChanged);
        $parent->trigger(static::$eventChildAdded);
        return $this->{$this->parentAttribute} = $parent->getRefId();
    }
public function setParent ( $ parent ) { if ( empty ( $ parent ) || $ this -> getRefId ( ) == $ parent -> getRefId ( ) || $ parent -> hasAncestor ( $ this ) || $ this -> hasReachedAncestorLimit ( ) ) { return false ; } unset ( $ this -> parent ) ; unset ( $ parent -> children ) ; $ this -> trigger ( static :: $ eventParentChanged ) ; $ parent -> trigger ( static :: $ eventChildAdded ) ; return $ this -> { $ this -> parentAttribute } = $ parent -> getRefId ( ) ; }
Set parent.
Don't forget save model after setting it.
@param static $parent
@return false|string False if restriction reached. Otherwise parent's GUID given.
Set parent . Don t forget save model after setting it .