code/Controller/AssetAdminFile.php
public static function nestedFolderIDs($parentID, $maxDepth = 5)
    {
        $ids = [$parentID];
        if ($maxDepth === 0) {
            return $ids;
        }
        $childIDs = Folder::get()->filter('ParentID', $parentID)->column('ID');
        foreach ($childIDs as $childID) {
            $ids = array_merge($ids, static::nestedFolderIDs($childID, $maxDepth - 1));
        }
        return $ids;
    }
public static function nestedFolderIDs($parentID, $maxDepth = 5)
    {
        $ids = [$parentID];
        if ($maxDepth === 0) {
            return $ids;
        }
        $childIDs = Folder::get()->filter('ParentID', $parentID)->column('ID');
        foreach ($childIDs as $childID) {
            $ids = array_merge($ids, static::nestedFolderIDs($childID, $maxDepth - 1));
        }
        return $ids;
    }
public static function nestedFolderIDs ( $ parentID , $ maxDepth = 5 ) { $ ids = [ $ parentID ] ; if ( $ maxDepth === 0 ) { return $ ids ; } $ childIDs = Folder :: get ( ) -> filter ( 'ParentID' , $ parentID ) -> column ( 'ID' ) ; foreach ( $ childIDs as $ childID ) { $ ids = array_merge ( $ ids , static :: nestedFolderIDs ( $ childID , $ maxDepth - 1 ) ) ; } return $ ids ; }
Get recursive parent IDs

@param int $parentID
@param int $maxDepth Hard limit of max depth
@return array List of parent IDs, including $parentID
Get recursive parent IDs