#101936Duplicate MM records after copy
Description
For TYPO3 11 (and 12) records with a bidirectional MM relations to themselves have duplicate MM records after copying them via DataHandler.
A prominent example would be EXT:news with its two columns related and related_from (stripped down to relevant parts):
EXT:news/Configuration/TCA/tx_news_domain_model_news.php:
'related' => [
'config' => [
'type' => 'group',
'allowed' => 'tx_news_domain_model_news',
'foreign_table' => 'tx_news_domain_model_news',
'MM_opposite_field' => 'related_from',
'MM' => 'tx_news_domain_model_news_related_mm',
],
],
'related_from' => [
'config' => [
'type' => 'group',
'foreign_table' => 'tx_news_domain_model_news',
'allowed' => 'tx_news_domain_model_news',
'MM' => 'tx_news_domain_model_news_related_mm',
'readOnly' => 1,
],
],
Scenario:
- Install EXT:news
- Create a folder with 2 news records, one refering to the other (via
relatedcolumn) - Copy that folder
| _.Original folder | _.Copied folder |
|---|---|
| Bildschirmfoto%20vom%202023-09-17%2023-35-14.png | Bildschirmfoto%20vom%202023-09-17%2023-35-35.png |
Expected result: 2nd folder with 2 news records, one refering one time to the other
**Actual result:** 2nd folder with 2 news records one refering three times to the other
With TYPO3 10 this worked as expected. And since the TCA in news hadn’t changed, I assume it’s a TYPO3 core issue. Plus I can reproduce it with pages records as well.
Hint: when unsetting the TCA for the related_from field, it’s working flawlessly.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] Duplicate MM records after copy Resolves: #101936 Releases: main