Bug #61344

findByRelation() does not work since 6.2.4

Added by Armin Vieweg almost 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2014-09-04
Due date:
% Done:

0%

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

Description

Hello,

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(
    'uid',
    'sys_file_reference',
    '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 BE Resolved 2014-07-31

History

#1 Updated by Armin Vieweg almost 5 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.

#2 Updated by Stefan Neufeind almost 5 years ago

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

#3 Updated by Armin Vieweg almost 5 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.

#4 Updated by Online Now! GmbH about 4 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.

#5 Updated by Klaus Hörmann-Engl about 4 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.

#6 Updated by Hendrik Nadler almost 4 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) :
    \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_file_reference');

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

#7 Updated by Rico Sonntag about 2 years ago

  • Category set to File Abstraction Layer (FAL)

#8 Updated by Rico Sonntag about 2 years ago

  • Category deleted (File Abstraction Layer (FAL))

#9 Updated by Riccardo De Contardi over 1 year 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 ?

#10 Updated by Riccardo De Contardi over 1 year 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