Conversion of Extbase to Doctrine query disregards enable field settings for join queries (MM relations)
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
::setEnableFieldsToBeIgnored() don't get applied when the query is converted into a Doctrine
::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).