#91453PersistedAliasMapper not finding record, if non-translated
Description
- Have a page-setup with two languages.
- Setup News-Extension for e.g. List view and Detail view on different pages.
- Those pages are all translated.
- Pages are language-strict, no language-fallbacks for page content is needed. Content is copied or re-created in the translated language.
- News-Records usually only exist in the root language (UID 0), they are never or only rarely translated. However, News of the root-language should still all be displayed on the translated pages as fallbacks as well. Therefore the NewsRepository is hooked and adjusted, so that languageFallbacks are applied. Query is adjusted in the NewsRepositoryHook:
$query->getQuerySettings()->setLanguageOverlayMode(true);
$query->getQuerySettings()->setLanguageMode('content_fallback');
This worked perfectly until TYPO3 v9.5.15. v9.5.14 still worked. Problem is a change in the PersistedAliasMapper and its *findByRouteFieldValue*-method.
PersistedAliasMapper @ v9.5.14:
$queryBuilder = $this->createQueryBuilder();
$result = $queryBuilder
->select(...$this->persistenceFieldNames)
->where($queryBuilder->expr()->eq(
$this->routeFieldName,
$queryBuilder->createNamedParameter($value, \PDO::PARAM_STR)
))
->execute()
->fetch();
return $result !== false ? $result : null;
PersistedAliasMapper @ v9.5.15:
$languageAware = $this->languageFieldName !== null && $this->languageParentFieldName !== null;
$queryBuilder = $this->createQueryBuilder();
$constraints = [
$queryBuilder->expr()->eq(
$this->routeFieldName,
$queryBuilder->createNamedParameter($value, \PDO::PARAM_STR)
),
];
$languageIds = null;
if ($languageAware) {
$languageIds = $this->resolveAllRelevantLanguageIds();
$constraints[] = $queryBuilder->expr()->in(
$this->languageFieldName,
$queryBuilder->createNamedParameter($languageIds, Connection::PARAM_INT_ARRAY)
);
}
$results = $queryBuilder
->select(...$this->persistenceFieldNames)
->where(...$constraints)
->execute()
->fetchAll();
// return first result record in case table is not language aware
if (!$languageAware) {
return $results[0] ?? null;
}
// post-process language fallbacks
return $this->resolveLanguageFallback($results, $this->languageFieldName, $languageIds);
The problem is easily found: In the new method, an extra constraint for sys_language_uid for the current FE-language is applied, although the News of the resolved News-Slug is not translated. This leads to the News not being found by the RouteEnhancer.
A simple check if l10n_parent and sys_language_uid are present in the record’s TCA are not enough. Complete language configuration including fallbacks need to be kept in mind here.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 2
History 6
-
Philipp Seiler changed description <span data-processor="relativetime" data-value="2020-05-22T09:22:27+00:00" > 05/22/20, 09:22 </span>
-
Oliver Hader changed Related to #89153 <span data-processor="relativetime" data-value="2020-06-02T17:11:53+00:00" > 06/02/20, 17:11 </span>
-
Benni Mack changed Related to #86444 <span data-processor="relativetime" data-value="2026-02-08T13:50:11+00:00" > 02/08/26, 13:50 </span>
-
Benni Mack commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2026-02-08T14:06:37+00:00" > 02/08/26, 14:06 </span>Hey Philipp,
circling back to this issue. The change was done intentionally.
If you want the “non-translated” record to be resolved, then your site configuration needs to reflect exactly that as well (exactly like news does it with “content_fallback”) – that means “strict” does not work, you need to put it to content_fallback and ensure that Language “0” should be included as well.
In v12 we’ve put quite again some more energy into Extbase extensions. Let me know if that works for you in recent versions. Otherwise we need to add an option into the site enhancer configuration, I assume?
-
Georg Ringer commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-09-30T05:32:15+00:00" > 09/30/26, 05:32 </span>closing issue as it is the desired behavior
Same problem here. Records won’t be found resulting in an error 404.
Rolled back to the old findByRouteFieldValue method.