Project

General

Profile

Actions

Bug #105843

open

Language fallback broken for objectstorages

Added by Jan Kornblum about 1 month ago. Updated 26 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Target version:
Start date:
2024-12-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.3
Tags:
extbase, localization, fallback, objectstorage, relation
Complexity:
Is Regression:
Sprint Focus:

Description

Language fallbacks currently don't work for objectstorages (and possibly other relation types too). Example use case:

  • Post <1:n> Comment ("inline" relation in TCA, objectstorage in Extbase)
  • Post records are localized (L=0 + L=1)
  • Comment records are NOT localized (only exist in L=0)
  • Site configuration "fallbackType" is "fallback" (with L=1 fallback to L=0)

Now showing a "Post" record in frontend in L=1, it doesn't show any related "Comment" records at all (when using $post->getComments()). Even when the "Comment" records are set to sys_language_uid = -1 they won't show up. As a workaround, instead of using $post->getComments() , i've added an own repository method $commentRepository->findByPost() like following:

class CommentRepository extends Repository
{

    public function findByPost(Post $post): QueryResultInterface|array
    {
        $query = $this->createQuery();
        $query->matching(
            $query->equals('post', $post->getUid()) // This uid comparision is the important part!
            //$query->equals('post', $post) // This fails
        );
        return $query->execute();
    }

}

This way the fallback behaviour works fine! The important part here is, that the constraint must explicitly compare against the "uid" (using $post->getUid() ). The "magic" repository method findBy***() fails here, too, because it down't seem to compare against the "uid" internally.

So i guess, there are some parts in core where this kind of uid comparison is still missing.


Related issues 4 (4 open0 closed)

Related to TYPO3 Core - Feature #94539: Documentation on how to work with 1:n and n:1 relations and translationsAccepted2021-07-12

Actions
Related to TYPO3 Core - Bug #102336: Add support for localizing n:1 relationsNew2023-11-07

Actions
Related to TYPO3 Core - Bug #89768: l10n_mode "exclude" does not work with inline typeAcceptedTymoteusz Motylewski2019-11-25

Actions
Related to TYPO3 Core - Bug #90430: Language handling of bidirectional mm selects is not consitent.Under Review2020-02-19

Actions
Actions #1

Updated by Garvin Hicking about 1 month ago

I've worked around this occassionally by using sys_language_uid=-1 here; then "all languages" is triggered more specifically.

(Not saying this issue here is [not] a bug, just stating another possible setuo)

Actions #2

Updated by Jan Kornblum about 1 month ago

Garvin Hicking wrote in #note-1:

I've worked around this occassionally by using sys_language_uid=-1 here; then "all languages" is triggered more specifically.

Thats what i've already tried yesterday in v12. But even with "sys_language_uid=-1" that didn't work (see above).

Actions #3

Updated by Tymoteusz Motylewski 26 days ago

  • Assignee deleted (Tymoteusz Motylewski)
Actions #4

Updated by Jan Kornblum 11 days ago

  • Related to Feature #94539: Documentation on how to work with 1:n and n:1 relations and translations added
Actions #5

Updated by Jan Kornblum 11 days ago

  • Related to Bug #102336: Add support for localizing n:1 relations added
Actions #6

Updated by Jan Kornblum 11 days ago

  • Related to Bug #89768: l10n_mode "exclude" does not work with inline type added
Actions #7

Updated by Jan Kornblum 11 days ago

  • Related to Bug #90430: Language handling of bidirectional mm selects is not consitent. added
Actions

Also available in: Atom PDF