Project

General

Profile

Actions

Bug #49211

closed

content of fileCollectionRepository is always empty

Added by Dominic Garms almost 11 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2013-06-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello,

currently I don't see any possibility to reach the folder of a FolderBasedFileCollection.

 /**
 * @var \TYPO3\CMS\Core\Resource\FileCollectionRepository
 * @inject
 */
 protected $fileCollectionRepository;

(...)

 $fileCollectionItem = $this->fileCollectionRepository->findByUid($uid);
 $content = $fileCollectionItem->loadContents();

$content is always empty and $fileCollectionItem->toArray() doesn't display the folder either.

Is there any documentation out how to reach the FolderBasedFileCollection?

For StaticFileCollection I currently use

 $fileRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
 $fileCollection = $fileRepository->findByRelation('sys_file_collection', 'files', $uid);
 foreach ($fileCollection as $item) {
   /** @var FileReference $item */
   $files[] = $item->toArray();
 }

But I'm unsure if this is correct, shouldn't work $fileCollection->loadContents() here as well?

Do I miss anything important for using the FAL FileCollections feature?

In xDebug I can see inside of my object all information, but no possibility to reach it through the given functions.

Regards,
Dominic

Actions #1

Updated by Mathias Schreiber over 9 years ago

  • Is Regression set to No
  • Sprint Focus set to On Location Sprint
Actions #2

Updated by Frans Saris about 9 years ago

  • Status changed from New to Closed

Use getItems() to get the File objects from collection.

    /** @var $fileCollection \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection */
    $fileCollection = $this->fileCollectionRepository->findByUid($this->getUid());
    $fileCollection->loadContents();
    $files = $fileCollection->getItems();
Actions #3

Updated by Anja Leichsenring over 8 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions

Also available in: Atom PDF