src/Charcoal/Object/HierarchicalTrait.php
public function setMaster($master)
    {
        $master = $this->objFromIdent($master);

        if ($master instanceof ModelInterface) {
            if ($master->id() === $this->id()) {
                throw new UnexpectedValueException(sprintf(
                    'Can not be ones own parent: %s',
                    $master->id()
                ));
            }
        }

        $this->master = $master;

        $this->resetHierarchy();

        return $this;
    }
public function setMaster($master)
    {
        $master = $this->objFromIdent($master);

        if ($master instanceof ModelInterface) {
            if ($master->id() === $this->id()) {
                throw new UnexpectedValueException(sprintf(
                    'Can not be ones own parent: %s',
                    $master->id()
                ));
            }
        }

        $this->master = $master;

        $this->resetHierarchy();

        return $this;
    }
Set this object's immediate parent.

@param  mixed $master The object's parent (or master).
@throws UnexpectedValueException The current object cannot be its own parent.
@return HierarchicalInterface Chainable