Extend tt_address with a mm_relation (Typo3 12)

I’ve been trying to extend tt_address with a mm_relation with not much luck so far. Anything I can find online is just for a regular relation, where the ID is saved directly into the same table, not an extra _mm table.
The backend looks fine so far, the way I want it with a selectMultipleSideBySide renderType. It also saves the relations to the database.

Typo3 12.4.16 // TT_Address 8.1.0 // extender 10.1.1

…/extensions/wiwa/Configuration/TCA/Overrides/tt_address.php

<?php
defined('TYPO3') or die();

use TYPO3CMSCoreUtilityExtensionManagementUtility;

(static function () {
    ExtensionManagementUtility::addTCAcolumns('tt_address',
        [
        'product_groups' => [
            'exclude' => true,
            'label' => 'LLL:EXT:wiwa/Resources/Private/Language/locallang_db.xlf:tx_wiwa_domain_model_product.product_group',
            'description' => 'Auswahl der WIWA-Produktkategorie',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_wiwa_domain_model_productgroup',
                'MM' => 'tt_address_productgroup_mm',                
                'default' => 0,
                'size' => 10,
                'autoSizeMax' => 30,
                'maxitems' => 3,
                'multiple' => true,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => true,
                    ],
                ],
            ],
           ],
          ],
    );

    ExtensionManagementUtility::addToAllTCAtypes(
        'tt_address',
        'product_groups',
        '',
        'before:name'
    );
})();        
I followed Extend models of tt_address
.../extensions/wiwa/ext_tables.sql
CREATE TABLE tt_address_productgroup_mm (
    uid_local int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
    sorting int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,

    PRIMARY KEY (uid_local,uid_foreign),
    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);
CREATE TABLE tt_address (
    product_groups int(11) unsigned DEFAULT '0',     
);  

…/extensions/wiwa/Classes/Extending/Domain/Model/Address.php

<<?php

declare(strict_types=1);

namespace ReplicareWiwaExtendingDomainModel;

class Address extends FriendsOfTYPO3TtAddressDomainModelAddress
{

    /**
     * productGroups
     *
     * @var TYPO3CMSExtbasePersistenceObjectStorage<ReplicareWiwaDomainModelProductGroup>
     */
    protected $productGroups = null;
    
    /**
     *
     * @return void
     */
    public function __construct()
    {
        $this->productGroups = $this->productGroups ?: new TYPO3CMSExtbasePersistenceObjectStorage();
    }    
    
    /**
     * Adds a productGroup
     *
     * @param ReplicareWiwaDomainModelProductGroup $productGroup
     * @return void
     */
    public function addProductGroup(ReplicareWiwaDomainModelProductGroup $productGroup)
    {
        $this->productGroups->attach($productGroup);
    }

    /**
     * Removes a productGroup
     *
     * @param ReplicareWiwaDomainModelproductGroup $productGroupToRemove The productGroup to be removed
     * @return void
     */
    public function removeProductGroup(ReplicareWiwaDomainModelProductGroup $productGroupToRemove)
    {
        $this->productGroups->detach($productGroupToRemove);
    }

    /**
     * Returns the productGroups
     *
     * @return TYPO3CMSExtbasePersistenceObjectStorage<ReplicareWiwaDomainModelProductGroup> $productGroups
     */
    public function getProductGroups()
    {
        return $this->productGroups;
    }

    /**
     * Sets the productGroups
     *
     * @param TYPO3CMSExtbasePersistenceObjectStorage<ReplicareWiwaDomainModelProductGroup> $productGroups
     * @return void
     */
    public function setProductGroups(TYPO3CMSExtbasePersistenceObjectStorage $productGroups)
    {
        $this->productGroups = $productGroups;
    }

}

Changes in ext_localconf.php are not needed anymore: Changelog extender
and I have configured extender in services.yaml following the instructions in the extender manual.

# Configuration/Services.yaml
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false


    
  ReplicareWiwaExtendingDomainModelAddress:
    tags:
      -
        name: 'extender.extends'
        class: FriendsOfTYPO3TtAddressDomainModelAddress    



The problem I’m having now is getting these relations in my fluid templates. The variable location.product_groups just contains the integer number of related objects, instead of the list of objects.
Extbase Variable Dump
How can I get the product_groups that are associated with that location in fluid, with an m:m relation?

New contributor

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

5

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