Bug #61344
closedfindByRelation() does not work since 6.2.4
0%
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.
Updated by Armin Vieweg about 10 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 10 years ago
it seems that "else" is in sysext/core/Classes/Resource/FileRepository.php
Updated by Armin Vieweg about 10 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 9 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 9 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 N over 9 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); }
Updated by Rico Sonntag over 7 years ago
- Category set to File Abstraction Layer (FAL)
Updated by Rico Sonntag over 7 years ago
- Category deleted (
File Abstraction Layer (FAL))
Updated by Riccardo De Contardi about 7 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 7 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.
Updated by Sybille Peters almost 2 years ago
- Related to Bug #99442: FileRepository::findByRelation() works differently in FE or other contexts and will not return the file reference objects in CLI context added
Updated by Sybille Peters almost 2 years ago
Why does this have "Needs Feedback" set and is closed?
I just reported a bug #99442 which looks very much similar if not duplicate (though I noticed the problem in CLI context, not in BE context).