public function getRoot()
    {
        $tmp_parent = $this->getParent();
        $root = $tmp_parent;
        while ($tmp_parent) {
            $root = $tmp_parent;
            $tmp_parent = $tmp_parent->getParent();
        }

        return $root;
    }
public function getRoot()
    {
        $tmp_parent = $this->getParent();
        $root = $tmp_parent;
        while ($tmp_parent) {
            $root = $tmp_parent;
            $tmp_parent = $tmp_parent->getParent();
        }

        return $root;
    }
public function getRoot ( ) { $ tmp_parent = $ this -> getParent ( ) ; $ root = $ tmp_parent ; while ( $ tmp_parent ) { $ root = $ tmp_parent ; $ tmp_parent = $ tmp_parent -> getParent ( ) ; } return $ root ; }
Returns the entity's root, if it has one.

@return EntityInterface|null
Returns the entity s root if it has one .