Bug #105843
openLanguage fallback broken for objectstorages
0%
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.
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)
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).
Updated by Tymoteusz Motylewski 26 days ago
- Assignee deleted (
Tymoteusz Motylewski)
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
Updated by Jan Kornblum 11 days ago
- Related to Bug #102336: Add support for localizing n:1 relations added
Updated by Jan Kornblum 11 days ago
- Related to Bug #89768: l10n_mode "exclude" does not work with inline type added
Updated by Jan Kornblum 11 days ago
- Related to Bug #90430: Language handling of bidirectional mm selects is not consitent. added