Bug #90013

Conversion of Extbase to Doctrine query disregards enable field settings for join queries (MM relations)

Added by Joschi Kuphal about 1 month ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-12-25
Due date:
% Done:

0%

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

Description

In order to apply custom enable field settings for nested entities, an overloaded QueryFactory can be used (as outlined in https://stackoverflow.com/a/39994951).

In that case, however, the settings made by Typo3QuerySettings::setIgnoreEnableFields() / ::setEnableFieldsToBeIgnored() don't get applied when the query is converted into a Doctrine QueryBuilder via Typo3DbQueryParser::convertQueryToDoctrineQueryBuilder() respectively ::initializeQueryBuilder(). When the source argument for the latter is a JOIN (which is the case for MM relations), the QueryBuilder is constituted with the unmodified DefaultRestrictionContainer, applying all the default restrictions regardless of the query's Typo3QuerySettings. This basically makes it impossible to query for nested entities that are e.g. hidden without removing the "disabled" enable field in TCA altogether.

My temporary workaround: I'm using a custom implementation of the Typo3DbQueryParser which amends the original convertQueryToDoctrineQueryBuilder() by selectively applying the enable field query settings to the Doctrine QueryBuilder restriction container (see attachment).

Typo3DbQueryParser.php View - Custom Typo3DbQueryParser with amended (2.14 KB) Joschi Kuphal, 2019-12-25 15:46

Also available in: Atom PDF