Project

General

Profile

Actions

Bug #67091

closed

FAL returns wrong data when reading files in collection

Added by André Spindler almost 9 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2015-05-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

To fetch files in sys_file_collection, I use the following code (TYPO3 is 6.2.12 with php 5.3.10-1ubuntu3.18):

/** @var \TYPO3\CMS\Core\Resource\FileCollectionRepository $fileCollectionRepository */
$fileCollectionRepository = GeneralUtility::makeInstance('\\TYPO3\\CMS\\Core\\Resource\\FileCollectionRepository');

$collection = $fileCollectionRepository->findByUid($collectionUid);
$collection->loadContents();

$collectionFiles = $collection->getItems();
if (count($collectionFiles)) {
    /** @var \TYPO3\CMS\Core\Resource\File $singleFile */
    foreach ($collectionFiles as $singleFile) {
        $files[] = $singleFile->getUid();
    }
}

Intention is to receive the uids of all the files in one or more file collections.

Now I have two file collections. The first "collection-1" is of type "folder", the second "collection-2" is of type "static".

When my code is processed for "collection-1", I get all files in the directory and in "$singleFile" I have the file object. And I receive the Uid of the file.
Thats working all fine as it should.

Now I do this again for "collection-2", and here I get wrong results. The items of the collection I get are declared to be files, but they are a mixture of file and reference. To point this out - type declaration is "\TYPO3\CMS\Core\Resource\File" (in method "\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::getItems()"). But when I fetch the uid (of the file I think), I receive the uid of the reference record between the file and the collection. This goeas alongside when getting all properties of this object and retreiving the uid from the returned array.

So this is a misbehaviour when retreiving the items: In the returned array of items, some have the correct uid of the file, others have the uid of the relation to the file. That's wrong.

Actions

Also available in: Atom PDF