src/storage/BaseFileSystemStorage.php
public function getFoldersArray()
    {
        if ($this->_foldersArray === null) {
            $query = (new Query())
                ->from('{{%admin_storage_folder}} as folder')
                ->select(['folder.id', 'name', 'parent_id', 'timestamp_create', 'COUNT(file.id) filesCount'])
                ->where(['folder.is_deleted' => false])
                ->orderBy(['name' => 'ASC'])
                ->leftJoin('{{%admin_storage_file}} as file', 'folder.id=file.folder_id AND file.is_deleted = 0')
                ->groupBy(['folder.id'])
                ->indexBy(['id']);

            $this->_foldersArray = $this->getQueryCacheHelper($query, self::CACHE_KEY_FOLDER);
        }

        return $this->_foldersArray;
    }
public function getFoldersArray()
    {
        if ($this->_foldersArray === null) {
            $query = (new Query())
                ->from('{{%admin_storage_folder}} as folder')
                ->select(['folder.id', 'name', 'parent_id', 'timestamp_create', 'COUNT(file.id) filesCount'])
                ->where(['folder.is_deleted' => false])
                ->orderBy(['name' => 'ASC'])
                ->leftJoin('{{%admin_storage_file}} as file', 'folder.id=file.folder_id AND file.is_deleted = 0')
                ->groupBy(['folder.id'])
                ->indexBy(['id']);

            $this->_foldersArray = $this->getQueryCacheHelper($query, self::CACHE_KEY_FOLDER);
        }

        return $this->_foldersArray;
    }
public function getFoldersArray ( ) { if ( $ this -> _foldersArray === null ) { $ query = ( new Query ( ) ) -> from ( '{{%admin_storage_folder}} as folder' ) -> select ( [ 'folder.id' , 'name' , 'parent_id' , 'timestamp_create' , 'COUNT(file.id) filesCount' ] ) -> where ( [ 'folder.is_deleted' => false ] ) -> orderBy ( [ 'name' => 'ASC' ] ) -> leftJoin ( '{{%admin_storage_file}} as file' , 'folder.id=file.folder_id AND file.is_deleted = 0' ) -> groupBy ( [ 'folder.id' ] ) -> indexBy ( [ 'id' ] ) ; $ this -> _foldersArray = $ this -> getQueryCacheHelper ( $ query , self :: CACHE_KEY_FOLDER ) ; } return $ this -> _foldersArray ; }
Get all storage folders as an array from database.

This method is used to retrieve all folders from the database and indexed by folder key.

@return array An array with all storage folders indexed by the folder id.
Get all storage folders as an array from database .