#90013Conversion of Extbase to Doctrine query disregards enable field settings for join queries (MM relations)
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).
Reviews 3
Related issues 1
Files 1
History 38
-
Markus Klein changed Related to #91324 <span data-processor="relativetime" data-value="2021-05-20T10:10:30+00:00" > 05/20/21, 10:10 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 96163 status
NewUnder Review <span data-processor="relativetime" data-value="2026-09-29T15:42:29+00:00" > 09/29/26, 15:42 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96163 <span data-processor="relativetime" data-value="2026-09-30T06:36:12+00:00" > 09/30/26, 06:36 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 96296 <span data-processor="relativetime" data-value="2026-10-02T07:13:34+00:00" > 10/02/26, 07:13 </span>
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 96296 <span data-processor="relativetime" data-value="2026-10-02T07:37:21+00:00" > 10/02/26, 07:37 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-02T07:55:09+00:00" > 10/02/26, 07:55 </span> -
Gerrit Code Review pushed patch set 1 for 13.4 to change 96709 status
ResolvedUnder Review <span data-processor="relativetime" data-value="2026-10-15T08:16:52+00:00" > 10/15/26, 08:16 </span> -
Alexander Schnitzler commented and changed status
Under ReviewResolved <span data-processor="relativetime" data-value="2026-10-17T13:46:05+00:00" > 10/17/26, 13:46 </span>Resolved by ca51b417c63 “Respect enable field settings for Extbase MM relations” (main, 14.3.8 via 7d31965b28f no backport to 13.4).
Covered by Extbase Functional
Persistence/MmRelationEnableFieldsTest:- @hiddenMmRelatedRecordIsNotReturnedWithEnableFieldsRespected@
- @hiddenMmRelatedRecordIsReturnedWhenEnableFieldsAreIgnored@
- @hiddenMmRelatedRecordIsReturnedWhenOnlyTheDisabledFieldIsIgnored@
Closing as resolved.
Applied in changeset commit:ca51b417c634c85e68a5a59ccd92f8bebe2bed6e.