Bug #61344

findByRelation() does not work since 6.2.4

Added by Armin Vieweg about 6 years ago. Updated almost 3 years ago.

Should have
File Abstraction Layer (FAL)
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:



several users of the DCE extension mentioned, that the output of FAL images in backend does not work anymore, since they've updated to TYPO3 6.2.4. In previous version it worked.

I don't know why, but somehow the following call will not return any results anymore:

$fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
return $fileRepository->findByRelation('tt_content', $field, $contentObject['uid']);
Of course the entries are existing. A manual get of the relation entries works:
$contentObjectUid = intval($contentObject['uid']);
/** @var t3lib_DB $typo3Database */
$typo3Database = Tx_Dce_Utility_DatabaseUtility::getDatabaseConnection();
$rows = $typo3Database->exec_SELECTgetRows(
    'tablenames = "tt_content" AND uid_foreign = ' . $contentObjectUid . ' AND fieldname = "' . $field . '"'
And with findFileReferenceByUid() I'll get the reference objects.

I'm using now this manual way of getting the references in my FalViewHelper.

Related issues

Related to Dynamic Content Elements (DCE) - Bug #60706: No Images rendered in BEResolved2014-07-31


Updated by Armin Vieweg about 6 years ago

Oh, I should mention that it just not works in backend context. In frontend it still seems to work. I've seen in this findByRelation() method is an if condition which checks the environment. Probably there is a bug in the else part, which represents the backend environment.


Updated by Stefan Neufeind about 6 years ago

it seems that "else" is in sysext/core/Classes/Resource/FileRepository.php


Updated by Armin Vieweg about 6 years ago

Yes, I am talking about the FileRepository object and its findByRelation() method. It contains an if condition checking the environment (FE or BE). The FE part works. The BE part not. But just since 6.2.4. In 6.2.3 everything worked fine.


Updated by Online Now! GmbH over 5 years ago

I can confirm this bug with TYPO 6.2.12. I am not able to get referenced files in a backend module with the findByRelation() function. The field i defined is a flexform field and not in the TCA. Might be the cause for this? I dont have the time at the moment to investigate this further.

Workaround is to get the relations manually.


Updated by Klaus Hörmann-Engl over 5 years ago

I can confirm this Bug with TYPO3 6.2.13. I tried to load referenced files in a backend TemplaVoila hook, for display in the backend. No fileReferences are returned.


Updated by Hendrik Nadler over 5 years ago

Bug still there in 6.2.14. I dont get the FE/BE else part anyways, TSFE is just used for enableFields. What about:

$enableFields = $this->getEnvironmentMode() === 'FE' && !empty($GLOBALS['TSFE']->sys_page) ?
    $GLOBALS['TSFE']->sys_page->enableFields('sys_file_reference', $GLOBALS['TSFE']->showHiddenRecords) :

$references = $this->getDatabaseConnection()->exec_SELECTgetRows(
    'tablenames=' . $this->getDatabaseConnection()->fullQuoteStr($tableName, 'sys_file_reference') .
    ' AND uid_foreign=' . (int)$uid .
    ' AND fieldname=' . $this->getDatabaseConnection()->fullQuoteStr($fieldName, 'sys_file_reference')
    . $enableFields,
if (!empty($references)) {
    $referenceUids = array_keys($references);

Updated by Rico Sonntag over 3 years ago

  • Category set to File Abstraction Layer (FAL)

Updated by Rico Sonntag over 3 years ago

  • Category deleted (File Abstraction Layer (FAL))

Updated by Riccardo De Contardi about 3 years ago

  • Category set to File Abstraction Layer (FAL)
  • Status changed from New to Needs Feedback

Can someone tell us if this still happen with 7.6.x or 8.7.x ?


Updated by Riccardo De Contardi almost 3 years ago

  • Status changed from Needs Feedback to Closed

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again, please reopen it or open a new issue with a reference to this one. Thank you.

Also available in: Atom PDF