public function getRoot($folderId)
    {
        $folder = FolderQuery::create()->findPk($folderId);

        if (0 !== $folder->getParent()) {
            $parentFolder = FolderQuery::create()->findPk($folder->getParent());

            if (null !== $parentFolder) {
                $folderId = $this->getRoot($parentFolder->getId());
            }
        }

        return $folderId;
    }
public function getRoot($folderId)
    {
        $folder = FolderQuery::create()->findPk($folderId);

        if (0 !== $folder->getParent()) {
            $parentFolder = FolderQuery::create()->findPk($folder->getParent());

            if (null !== $parentFolder) {
                $folderId = $this->getRoot($parentFolder->getId());
            }
        }

        return $folderId;
    }
public function getRoot ( $ folderId ) { $ folder = FolderQuery :: create ( ) -> findPk ( $ folderId ) ; if ( 0 !== $ folder -> getParent ( ) ) { $ parentFolder = FolderQuery :: create ( ) -> findPk ( $ folder -> getParent ( ) ) ; if ( null !== $ parentFolder ) { $ folderId = $ this -> getRoot ( $ parentFolder -> getId ( ) ) ; } } return $ folderId ; }
Get the root folder
@param  int   $folderId
@return mixed
Get the root folder