Bug #88951

Extbase does not handle page translations correctly when using consistentTranslationOverlayHandling

Added by Lars Peter Søndergaard about 1 year ago. Updated about 1 year ago.

Should have
Extbase + l10n
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


My scenario:

I mapped the "pages" table to an extbase model named "Product", using a custom doktype. So in ext_typoscript_setup.typoscript I have something like this:

config.tx_extbase {
    persistence {
        classes {
            LFM\MyProducts\Domain\Model\Product {
                mapping {
                    tableName = pages
                    recordType = 133
                    columns {
                        doktype.mapOnProperty = doktype
                        l10n_parent.mapOnProperty = parentRecord

This works fine, until I try to read records using a "ProductRepository".

Let's say, we got a "product" page with uid=5, and a translation of that page, with uid=6 and l10n_parent=5.

Using productRepository->findAll() in context of default language, everything works as expected. Product object with uid=5 is returned. In context of the translated language, the findAll method however returns an object that has uid set to 6 instead of 5, and _localizedUid is set to 6 as well.

I tried to test the same with a "normal" Dummy model that is mapped to a regular "tx_myproducts_domain_model_dummy" table. Using that, everything works exactly as expected. (having default language uid=1 and translation uid=2, findAll() returns uid=1 in both default language context as well as translated context, with only _localizedUid having value 2 in translated context).

The primary suspect seems to be the method \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::overlayLanguageAndWorkspace.

Some tests have shown that extbase always fetches the translated records in translated context. So the passed $rows array in that overlayLanguageAndWorkspace method contains a list of translated page records. For non-pages records it seems there is a "fix" to pretend to be a default language record, before calling getRecordOverlay, but the same thing is not done for pages record. Instead getPageOverlay is called directly with the (presumably incorrect) translated records.

typo3dbbackend.patch View (4.16 KB) Lars Peter Søndergaard, 2019-09-27 09:03


#1 Updated by Lars Peter Søndergaard about 1 year ago

The primary issue seems to be, that $pageRepository->getPageOverlay returns an array with a _PAGES_OVERLAY_UID key and $pageRepository->getRecordOverlay returns an array with a _LOCALIZED_UID, and only the latter is used by extbase later on to properly handle translations.

I attached a patch with a fix that seems to work so far.
It reorders a section of the code (concerning cases where respect language is false), though I'm not sure that part is correct.

The primary fix was remapping the _PAGES_OVERLAY_UID to _LOCALIZED_UID.

The same issue might also exist for the other (old) doLanguageAndWorkspaceOverlay, but I ignored that one, since it's removed on master.

Also available in: Atom PDF