Bug #87833

Detect missing file for a given FileReference in Extbase

Added by Jan Kornblum 5 months ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2019-03-04
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I've tried three different ways to detect if a `FileReference`'s original file is still existing (i.e. file has been deleted outside TYPO3 using SFTP or similar):

if($fileReference instanceof \TYPO3\CMS\Extbase\Domain\Model\FileReference) {
    $isMissing = $fileReference->getOriginalResource()->getStorage()->getFile($fileReference->getOriginalResource()->getIdentifier())->isMissing();
    $isMissing = $fileReference->getOriginalResource()->getOriginalFile()->isMissing();
    $isMissing = $fileReference->getOriginalResource()->isMissing();
}

Only the first one gives me the right `isMissing()` value. In addition, there is no possibility in FLUID to check against missing files for a fiven relation. You have to write an own viewhelper using the code above for this.

Also available in: Atom PDF