Project

General

Profile

Actions

Bug #104331

open

\TYPO3\CMS\Core\Resource\FileRepository::findByRelation incapable of handling FAL relations in FlexForm in BE context

Added by Claus Due about 10 hours ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2024-07-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The method internally assumes that any fieldname passed to the function is a root-level TCA field. It completely ignores that FAL relations are also possible within a FlexForm context. Specifically, BackendUtility::getTcaFieldConfiguration($tableName, $fieldName) fails if $fieldName is not a root-level TCA field, causing the findByRelation to always return an empty set. Note that BackendUtility::getTcaFieldConfiguration is incapable of returning a TCEforms config array from within a FlexForm DS regardless of how you construct the $field argument.

The same problem does not exist in FE context because the method internally switches to a standard query. But in FE context another problem exists - it completely ignores any and all additional DB relation constraints like `MM_match_fields`, and ignores the workspace ID. As such it is broken for anything other than a completely vanilla FAL IRRE setup.

Unfortunately this means that the FileRepository is not trustworthy in either context. Either it is partially broken, or it is incomplete - neither context is fully functional.

One solution could be to make \TYPO3\CMS\Core\Resource\FileRepository::findByRelation require a TCA config array as argument, avoid the use of BackendUtility::getTcaFieldConfiguration and then make it use RelationHandler exclusively and drop the condition block that switches to a query in FE context. Not only would that fix the described problems, it would also reduce the complexity of FileRepository itself.

PS: This problem exists in all versions of TYPO3 since the introduction of FileRepository but the TYPO3 version of this issue has been set to 12 since that's the only LTS that needs to be fixed. If ELTS also needs to be fixed this version goes back a lot further.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #99442: FileRepository::findByRelation() works differently in FE or other contexts and will not return the file reference objects in CLI contextNew2023-01-01

Actions
Actions #1

Updated by Claus Due about 10 hours 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
Actions

Also available in: Atom PDF