Bug #88951

Extbase does not handle page translations correctly when using consistentTranslationOverlayHandling

Added by Lars Peter Søndergaard almost 3 years ago. Updated over 2 years ago.

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


Estimated time:
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 (4.16 KB) typo3dbbackend.patch Lars Peter Søndergaard, 2019-09-27 09:03

Also available in: Atom PDF