Project

General

Profile

Actions

Bug #102604

open

PersistedAliasMapper on translated extbase records wrong

Added by Lois Mula Fervenza 12 months ago. Updated 3 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2023-12-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

With a language configuration of fallbackType free, the translated extbase records are not found by the RouteEnhancer PersistedAliasMapper.
The reason for this is that the UID of the extbase record from the default language is used and therefore the wrong slug is used for routing.
As soon as the l10n_parent is removed in the translated extbase record, it works.
I currently have this problem with records from the News Extension.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #102703: Persisted alias mapper should return item uid instead of languageParentFieldName when site translation fallbackType is set to freeNew2023-12-20

Actions
Actions #1

Updated by Thomas Stranz 3 months ago

Lois Mula Fervenza wrote:

With a language configuration of fallbackType free, the translated extbase records are not found by the RouteEnhancer PersistedAliasMapper.
The reason for this is that the UID of the extbase record from the default language is used and therefore the wrong slug is used for routing.
As soon as the l10n_parent is removed in the translated extbase record, it works.
I currently have this problem with records from the News Extension.

I can confirm this behavior on TYPO3 12.4.20 with the following site config:

routeEnhancers:
  News:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      -
        routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

I could solve this for our project by overriding the resolveOverlay function in \TYPO3\CMS\Core\Routing\Aspect\PersistedAliasMapper via XCLASS

    protected function resolveOverlay(?array $record): ?array
    {
        $languageId = $this->siteLanguage->getLanguageId();
        if ($record === null || $languageId === 0) {
            return $record;
        }

        $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
        $qb->select(...$this->persistenceFieldNames)->from($this->tableName)
            ->where($qb->expr()->eq('l10n_parent', $record['uid']))
            ->andWhere($qb->expr()->eq('sys_language_uid', $languageId));

        $overlay = $qb->executeQuery()->fetchAssociative();
        if ($overlay) {
            return $overlay;
        }

        return $record;
    }
Actions #2

Updated by Thomas Stranz 3 months ago

  • Related to Bug #102703: Persisted alias mapper should return item uid instead of languageParentFieldName when site translation fallbackType is set to free added
Actions

Also available in: Atom PDF