0

I have TYPO3 11.5. I have a custom model "Atto". In my TCA configuration i used:

'atto' => [

            'exclude' => true,
    
            'label' => 'Atti',
    
            'config' => [
    
                'type' => 'group',
    
                'internal_type' => 'db',
    
                'allowed' => 'tx_atto_domain_model_atto',
    
                'MM' => 'tx_atto_domain_model_atto_mm',
    
                'foreign_table' => 'tx_atto_domain_model_atto',
    
                'foreign_table_where' => ' AND (tx_atto_domain_model_modelloatto.sys_language_uid IN (-1,0) OR tx_atto_domain_model_modelloatto.l10n_parent = 0) ORDER BY tx_atto_domain_model_modelloatto.title',
    
                'MM_opposite_field' => 'atto',

                'size' => 10,
    
                'minitems' => 0,
    
                'maxitems' => 99,
    
                'fieldControl' => [
    
                    'editPopup' => [
    
                        'disabled' => false,
    
                        'options' => [
    
                            'type' => 'popup',
    
                            'title' => 'edit',
    
                            'module' => [
    
                                'name' => 'wizard_edit',
    
                            ],
    
                            'popup_onlyOpenIfSelected' => true,
    
                            'icon' => 'actions-open',
    
                            'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
    
                        ],
    
                    ],
    
                    'listModule' => [
    
                        'disabled' => false,
    
                        'options' => [
    
                            'type' => 'script',
    
                            'title' => 'list',
    
                            'icon' => 'actions-system-list-open',
    
                            'params' => [
    
                                'table' => 'tx_atto_domain_model_atto',
    
                 
    
                            ],
    
                            'module' => [
    
                                'name' => 'wizard_list',
    
                            ],
    
                        ],
    
                    ],
    
                ],
    
                'behaviour' => [
    
                    'allowLanguageSynchronization' => true,
    
                ],
    
            ],
    
        ],

The relation works but I don't see the relation with the related content, it's not bidirectional. How can I get to the result I want to achieve? I assumed a save hook but I don't know if it's the correct solution, especially considering the workspaces.

MarioProject
  • 417
  • 4
  • 25

2 Answers2

0

I think I've found a solution. Bidirectionality can be obtained with another field of the same table. It's not the exact same thing but it's the only possibility I've found and works well with workspaces

MarioProject
  • 417
  • 4
  • 25
0

I have created a bidirectional relation as follows in TYPO3 CMS 10. This should be adaptable for other TYPO3 versions as well. In this artisans are linked to events and vice versa. And this is how it is done.

tx_placeholder_domain_model_artisan.php

'columns' => [
        'events' => [
            'label' => 'LLL:EXT:placeholder/Resources/Private/Language/locallang_db.xlf:events',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_placeholder_domain_model_event',
                'foreign_sortby' => 'sorting_foreign',
                'foreign_table_where' => 'ORDER BY start_date DESC',
                'MM' => 'tx_placeholder_artisan_event_mm',
                'autoSizeMax' => 20,
                'maxitems' => 999,
                'multiple' => true,
                'enableMultiSelectFilterTextfield' => true,
            ],
        ],
],

tx_placeholder_domain_model_artisan.php

'columns' => [
        'artisans' => [
            'label' => 'LLL:EXT:placeholder/Resources/Private/Language/locallang_db.xlf:artisans',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_placeholder_domain_model_artisan',
                'foreign_table_where' => 'ORDER BY name ASC,first_name ASC,company ASC',
                'MM' => 'tx_placeholder_artisan_event_mm',
                'MM_opposite_field' => 'artisans',
                'autoSizeMax' => 20,
                'maxitems' => 999,
                'multiple' => true,
                'enableMultiSelectFilterTextfield' => true,
            ],
        ], 
],

ext_tables.sql

CREATE TABLE tx_placeholder_domain_model_artisan
(
    events                  int(11) unsigned    DEFAULT '0',
);

CREATE TABLE tx_placeholder_domain_model_event
(
    artisans          int(11) unsigned DEFAULT '0'        NOT NULL,
);

CREATE TABLE tx_placeholder_artisan_event_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,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);
Heinz Schilling
  • 2,177
  • 4
  • 18
  • 35