TYPO3 Extbase Extension with bidirectional mm-relation messed up language relation fields

System: TYPO3 11.5.36 with own expansion to display news and persons. Running on Apache with PHP 7.4.33 and MySQL 5.5.5-10.5.23-MariaDB-0+deb11u1

Setup: We have a person model and a news model.
The news have a property authors and the persons the property news.

Problem: On translated news records the authors will only show up, if we save the news. But when we save the person, the author is only shown in the default language, not in the translated language.
While saving the news record, we have a entry in MM-table for the german and english news with the german ids of the persons. But when we save the person, we have two german news-ids with a german and english person id. It’s flipped around. How to avoid this?
There is no fancy stuff going on in the controller action or in the fluid template. We can’t figure out, how to configurate the property, or how to write a query to address this issue. Are we miss here something?

Details:
In the backend, we create a new news and assign an existing person as author. Then translate the news (the person is already translated). Then we see the authors on the news page in the frontend for the default language (german) and the translated version (english). This is working!
Then when saving the person record without changing any data, the translated record won’t show the author anymore.

Example:

table language uid
person 0 (ger) 1
person 1 (eng) 2
news 0 (ger) 10
news 1 (eng) 11

MM-Table looks like this while saving on news:

uid_local (news) uid_foreign (person)
10 1
11 1

MM-Table looks like this while saving on person:

uid_local (news) uid_foreign (person)
10 1
10 2
// TCA from news:

'authors' => array(
            'exclude' => 0,
            'displayCond' => 'FIELD:sys_language_uid:<=:0',
            'l10n_mode' => 'exclude',
            'label' => 'LLL:EXT:fgsnews/Resources/Private/Language/locallang_db.xlf:tx_fgsnews_domain_model_news.authors',
            'config' => array(
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_fgspersons_domain_model_person',
                'foreign_table_where' => "
                    AND tx_fgspersons_domain_model_person.sys_language_uid in (-1,0)
                    AND tx_fgspersons_domain_model_person.hidden = 0
                    ORDER BY tx_fgspersons_domain_model_person.last_name ASC
                ",
                'MM' => 'tx_fgsnews_news_person_mm',
                'autoSizeMax' => 30,
                'maxitems' => 9999,
                'multiple' => 1,
                'wizards' => array(
                    '_PADDING' => 1,
                    '_VERTICAL' => 1,
                    'suggest' => array(
                        'type' => 'suggest',
                        'default' => array(
                            'searchWholePhrase' => 1,
                            'additionalSearchFields' => 'first_name,last_name',
                        ),
                    ),
                ),
                'behaviour' => [
                    'allowLanguageSynchronization' => false,
                ],
            ),
        )
/// TCA from person:

'news' => array(
        'displayCond' => 'FIELD:sys_language_uid:<=:0',
        'exclude' => 0,
        'label' => 'News',
        'config' => array(
            'type' => 'select',
            'renderType' => 'selectMultipleSideBySide',
            'foreign_table' => 'tx_fgsnews_domain_model_news',
            'foreign_table_where' => "
                    AND tx_fgsnews_domain_model_news.sys_language_uid IN (-1,0)
                    AND tx_fgsnews_domain_model_news.hidden = 0
                    ORDER BY tx_fgsnews_domain_model_news.starttime Desc
                ",
            'MM' => 'tx_fgsnews_news_person_mm',
            'MM_opposite_field' => 'authors',
            'autoSizeMax' => 30,
            'maxitems' => 999,
            'multiple' => 1,
            'wizards' => array(
                '_PADDING' => 1,
                '_VERTICAL' => 1,
                'suggest' => array(
                    'type' => 'suggest',
                    'default' => array(
                        'searchWholePhrase' => 1
                    ),
                ),
            ),
            'l10n_mode' => 'exclude',
            'behaviour' => [
                'allowLanguageSynchronization' => false,
            ],
        ),
    )
// News Controller - Action:

public function showAction(News $news) {
        $this->view->assign('news', $news);

        $authorNames = [];
        $authors = $news->getAuthors();
        $validAuthors = array();

        foreach ($authors as $author) {
            $authorNames[] = $author->getFullname();
            $personType = $author->getType();
            if ($personType != null && $personType->getVisibility() == 2) {
                $validAuthors[] = $author;
            }
        }

        $this->view->assign('authors', $validAuthors);
    }
// Fluid Template

<f:if condition="{authors}">
    <article class="frame frame-mask_text frame-width-85 action-show">
        <div class="frame-content">
            <div class="bodytext person-contacts">
                <f:for each="{authors}" as="person">
                    <f:render partial="Person/Contact" arguments="{person: person}" />
                </f:for>
            </div>
        </div>
    </article>
</f:if>

We tried different settings with l10n_mode and allowLanguageSynchronization, but it ended up in the same results.

If we save the news, everything is working fine. But if we save the person the uid’s in the mm-table get flipped around which causes the problem. We need it to be persistant, so that we can handle and edit the associations bidirectional in both records.

New contributor

user25189056 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật