Project

General

Profile

Actions

Bug #103604

open

MM table generation sets wrong PRIMARY KEY for columns with multiple=1

Added by Oliver Eglseder about 1 month ago. Updated 28 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-04-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

A TCA select column with multiple=1 generates a PRIMARY KEY over the fields `uid_local` and `uid_foreign` of the MM table.
When multiple is active, i can select a record from `tx_tea_domain_model_coffee` multiple times.
When i save the record i get the exception `An exception occurred while executing a query: Duplicate entry '1-2' for key 'tx_tea_tea_coffee_mm.PRIMARY'`

TCA column:

'test' => [
    'exclude' => 1,
    'l10n_mode' => 'exclude',
    'label' => 'test',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectMultipleSideBySide',
        'foreign_table' => 'tx_tea_domain_model_coffee',
        'foreign_table_where' => 'AND tx_tea_domain_model_coffee.sys_language_uid IN (-1,0) Order by title ASC',
        'MM' => 'tx_tea_tea_coffee_mm',
        'size' => 10,
        'autoSizeMax' => 30,
        'maxitems' => 9999,
        'multiple' => 1,
    ],
],

Database Analyzer Output:

CREATE TABLE tx_tea_tea_coffee_mm (
    uid_local INT UNSIGNED DEFAULT 0 NOT NULL,
    uid_foreign INT UNSIGNED DEFAULT 0 NOT NULL,
    sorting INT UNSIGNED DEFAULT 0 NOT NULL,
    sorting_foreign INT UNSIGNED DEFAULT 0 NOT NULL,
    INDEX uid_local (uid_local),
    INDEX uid_foreign (uid_foreign),
    PRIMARY KEY(uid_local, uid_foreign)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #101425: TYPO3 and MariaDB Galera Cluster (PRIMARY KEY)Closed2023-07-24

Actions
Related to TYPO3 Core - Task #101554: Get rid of MM_hasUidFieldClosed2023-08-03

Actions
Actions

Also available in: Atom PDF