Get the root folder
@param  int   $folderId
@return mixed
193061
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;
    }
1253804
public function getRootDirectory()
    {
        if(isset($this->rootDirectory) == false) {
            $this->rootDirectory = $this->locateRootDirectory();
        }
        return $this->rootDirectory;
    }
913831
public function getAvatarPath($userId)
    {
        $avatarPath = $this->getSetting('avatarPath') . '/' . $this->getAvatarSubPath($userId);
        if (!is_dir($avatarPath)) {
            FileHelper::createDirectory($avatarPath);
        }
        return $avatarPath . substr($userId, -2);
    }
233900
public function findByFolderId($folderId)
    {
        $qb = $this->createQueryBuilder();

        $qb->field('mediaFolder.id')->equals($folderId);

        return $qb->getQuery()->execute();
    }
395771
private function getPath($folderId)
    {
        $folder = $this->repository->find($folderId);
        $path = [];
        while ($folder) {
            $path[] = $folder;
            $folder = $folder->folder;
        }

        $firstItem = new stdClass();
        $firstItem->name = __('Files');
        $firstItem->type = 'f';
        $firstItem->id = '';

        $path[] = $firstItem;
        $path = array_reverse($path);

        return $path;
    }
756572
public static function nodeChildren($parentId)
    {
        $parentId = intval($parentId);
        if (!static::$caching || empty(static::$_children[$parentId])) {
            $query = static::find()
                ->where(['parent_id' => $parentId])
                ->orderBy(static::$defaultOrderBy);
            $childList = $query
              //->asArray()
                ->all();
            if (static::$caching) {
                static::$_children[$parentId] = $childList;
            } else {
                return $childList;
            }
        }
        return static::$_children[$parentId];
    }
1271038
public function getFromId( $diskId){
        $rest = $this->getService( self::API_STORAGE_DISK . $diskId);
        $rest->GET();

        return $rest->getResult( models\Storage\StorageDisk::class);
    }
1133362
protected function getFilesystemFor($fileID)
    {
        return $this->applyToFileIDOnFilesystem(
            function (ParsedFileID $parsedFileID, Filesystem $fs) {
                return $fs;
            },
            $fileID
        );
    }
1101713
public function fetchTree($rootId=null, $depth=null)
    {
        $wrappers = $this->fetchTreeAsArray($rootId, $depth);

        return (!is_array($wrappers) || empty($wrappers)) ? null : $wrappers[0];
    }
121685
public function getRootDir()
    {
        static $dir;
        if (empty($dir)) {
            $rc = new \ReflectionClass(get_class($this));
            $dir = dirname(dirname($rc->getFileName()));
        }
        return $dir;
    }
718345
public function getParentId($id)
    {
        $path = $this->getProperty($id, self::PATH);
        array_pop($path);

        return empty($path)
            ? null // the given item is the root
            : array_pop($path);
    }
1223985
public function getDeviceHierarchy($deviceId)
    {
        $devices = array();

        while (strcmp($deviceId, 'root')) {
            /** @var $device \Wurfl\Device\ModelDeviceInterface */
            $device = $this->getDevice($deviceId);

            if (!($device instanceof ModelDeviceInterface)) {
                throw new \InvalidArgumentException('one of the parent devices is missing for deviceId ' . $deviceId);
            }

            $devices[] = $device;
            $deviceId  = $device->fallBack;
        }

        return $devices;
    }
1301886
public function getFile($fileId)
    {
        $this->connect();

        $fileId = trim(trim($fileId, '/'));
        if ($fileId != '')
        {
            if (strpos($fileId, '/') === false)
            {
                $folder = $this->getFolder();
            }
            else
            {
                $pathinfo = pathinfo($fileId);
                $folder   = $this->getFolder($pathinfo['dirname']);
            }
            if ($folder)
            {
                return $folder->getFile($fileId);
            }
        }

        return false;
    }
879413
public function setFolderId( $folder_id )
	{
		$this->folder_id = (is_numeric($folder_id)) ? abs(round($folder_id)) : NULL;

		return $this;
	}
259298
public function getRootId()
    {
        if (empty($this->hierarchy)) {
            throw new Exception\LogicException('The root item does not exist.');
        }

        reset($this->hierarchy);
        $id = key($this->hierarchy);

        return $id;
    }
1071189
public function getParentIds($rootId = 0)
    {
        if ($this->_parentIds === null) {
            // 增加对模型内置[[getAll()]]方法的支持，可避免多次查询数据库，优化性能
            if ($this->owner->hasMethod('getAll')) {
                $this->_parentIds = $this->getParentIdsInternal($rootId);
            } else {
                $this->_parentIds = Tree::getParentIds($this->owner, 0, $this->pkField, $this->parentField, $rootId);
            }
        }
        
        return $this->_parentIds;
    }
81748
public function getByNodeId($nodeId)
    {
        foreach ($this->siterootManager->findAll() as $siteroot) {
            $tree = $this->getBySiteRootId($siteroot->getId());

            if ($tree->has($nodeId)) {
                return $tree;
            }
        }

        throw new NodeNotFoundException("Tree for node ID $nodeId not found.");
    }