#110904Creating a workspace version modifies live MM rows and deletes MM rows of other workspaces
Description
Description
When a record holding an MM relation is versioned, DataHandler::remapListedDBRecords_procDBRefs() runs the block “If record has been versioned/copied in this process, handle invalid relations of the live record”: it reads the MM relations of the live record in workspace 0, purges all workspace records from them and, if anything was purged, writes the remaining relations back to the live record with RelationHandler::writeMM().
This has two side effects, although the editor only works in a workspace:
writeMM()renumbers the sorting of the live MM rows, so live data changes. The reference index of the live record is not updated accordingly and is left dirty.- All MM rows of the live record pointing to workspace records are deleted, including the ones belonging to versions in other workspaces.
How to reproduce
Core functional test fixture EXT:core/Tests/Functional/Fixtures/Extensions/test_mm, data set DataScenarios/ManyToMany/DataSet/ImportDefaultWorkspaces.csv:
tx_test_mm.group_mm_1_local(local side,MM_oppositeUsage) <->tt_content.group_mm_1_foreign(foreign side,MM_opposite_field), MM tablegroup_mm_1_relations_mm
- Workspace 2: modify
tt_content:297(creates version 299). The MM rows28 -> 299and29 -> 299are created for the version. - Workspace 1: modify
tx_test_mm:28(creates version 32)
MM table afterwards:
| _.uid_local | _.uid_foreign | _.sorting | _.sorting_foreign | |
|---|---|---|---|---|
| 28 | 297 | 1 | 1 | live row, sorting changed (was 0) |
| 29 | 297 | 0 | 2 | live |
| 32 | 297 | 1 | 0 | version of tx_test_mm:28 in workspace 1 |
| 29 | 299 | 0 | 2 | version of tt_content:297 in workspace 2 |
The row 28 -> 299 of workspace 2 has been deleted. In workspace 2, content element 297 loses its relation to tx_test_mm:28 (“Surf A”), and publishing workspace 2 removes the relation from live.
The live sorting change also happens within one workspace: modify tt_content:297 and then tx_test_mm:28 in workspace 1, the live row 28 -> 297 changes from sorting=0 to sorting=1.
Expected behaviour
Creating a workspace version neither modifies MM rows of the live record nor MM rows of other workspaces.
Reviews 1
History 02
-
Gerrit Code Review pushed patch set 1 for main to change 96344 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-03T06:07:37+00:00" > 10/03/26, 06:07 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96344 <span data-processor="relativetime" data-value="2026-10-03T06:21:00+00:00" > 10/03/26, 06:21 </span>