Deleting records

Deleting a record through the DataHandler can touch more than the record itself: its translations, the children of its inline relations and the rows of its MM relations. Each scenario below deletes the same record once through the DataHandler and once through Extbase, as the same administrator at the same fixed time, and compares the resulting tables. Where the DataHandler side imitates the backend form, its scenario says so.

Provenance

Tests ran on main (15.0-dev), which is assumed to behave as TYPO3 14.3.

Summary

9 scenarios, by Extbase status:

Comparison

ScenarioCoreExtbase
Deleted record is marked deleted An English item without translation is deleted through DataHandler. DataHandler keeps the row, sets deleted to 1 and sets tstamp to the current time. Same as coreExtbase keeps the row, sets deleted to 1 and sets tstamp to the current time, like DataHandler.
Deleting the default record deletes its translations The English item 1, which has the German translation 2, is deleted through DataHandler. DataHandler marks the translation deleted as well: deleted 1 and the current tstamp on both rows. DeviatesExtbase marks only the English item 1 deleted. The German translation 2 keeps deleted 0 and its old tstamp.
Deleting a translation deletes only the translation The German translation 2 of item 1 is deleted through DataHandler. DataHandler marks only the translation deleted; the English item 1 stays untouched. DeviatesExtbase marks the English item 1 deleted, not the German translation 2, which stays untouched. This is the case although the object was read as the German translation.
Deleting a record deletes its inline children Item 1 with the notes 1 and 2 in an inline field is deleted through DataHandler. DataHandler marks both notes deleted together with the item. DeviatesExtbase marks only the item deleted. Both notes keep deleted 0 and their old tstamp, because the property holding them is not mapped with cascade remove.
Deleting a record deletes its inline children with cascade remove Item 1 with the notes 1 and 2 in a second inline field is deleted through DataHandler. DataHandler marks both notes deleted together with the item, no matter how the property is mapped in Extbase. Same as coreExtbase marks the item and both notes deleted, because the property holding the notes is mapped with cascade remove.
A record without delete column is removed A record of a table without delete column is deleted through DataHandler. DataHandler removes the row from the table. Same as coreExtbase removes the row from the table, like DataHandler.
Mm rows of a removed record A record of a table without delete column and with the tags 1 and 2 is deleted through DataHandler. DataHandler removes the row and its two rows in the relation table; the tags stay. Same as coreExtbase removes the row and its two rows in the relation table, like DataHandler; the tags stay.
Mm rows of a soft deleted record Item 1 with the tags 1 and 2 is deleted through DataHandler. DataHandler marks the item deleted and keeps its two rows in the relation table. Same as coreExtbase marks the item deleted and keeps its two rows in the relation table, like DataHandler.
Removing a child from the parent An editor removes the note 1 from the inline field of item 1 in the backend form. The form sends the remaining list with the note 2 as the only entry in the datamap and a delete command for the note 1 in the cmdmap, and DataHandler processes both in one run. DataHandler marks the note 1 deleted with the current tstamp; its field pointing to the item keeps the uid. The counter of the field drops to 1 and the tstamp of the item and of the note 2 is set to the current time. DeviatesExtbase does not delete the note 1. It detaches it: deleted stays 0 and its field pointing to the item is set to 0, so the note stays in the table as an orphan. The counter of the field drops to 1 and the tstamp of the item is set to the current time; the note 2 stays untouched.

Scenarios

Deleted record is marked deleted

Same as core

In 14.3

Core: An English item without translation is deleted through DataHandler. DataHandler keeps the row, sets deleted to 1 and sets tstamp to the current time.

Extbase: Extbase keeps the row, sets deleted to 1 and sets tstamp to the current time, like DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:79 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:101 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedRecord.csv (local)

Deleting the default record deletes its translations

Deviates

In 14.3

Core: The English item 1, which has the German translation 2, is deleted through DataHandler. DataHandler marks the translation deleted as well: deleted 1 and the current tstamp on both rows.

Extbase: Extbase marks only the English item 1 deleted. The German translation 2 keeps deleted 0 and its old tstamp.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:121 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:143 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedDefaultRecordWithTranslation.csv (local)
SkipExtbase differs from core: it marks only the default record deleted and leaves its translations untouched.
TestDeletingTest::deletingTheDefaultRecordDeletesItsTranslationsByExtbase (Failure without skip)
Assertion in data-set failed for "tx_extbasefacts_domain_model_item:2":
Fields |Assertion |Record
deleted|1         |0
tstamp |1700000000|1500000000

Deleting a translation deletes only the translation

Deviates

In 14.3

Core: The German translation 2 of item 1 is deleted through DataHandler. DataHandler marks only the translation deleted; the English item 1 stays untouched.

Extbase: Extbase marks the English item 1 deleted, not the German translation 2, which stays untouched. This is the case although the object was read as the German translation.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:166 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:188 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedTranslation.csv (local)
SkipExtbase differs from core: it marks the default record deleted instead of the translation.
TestDeletingTest::deletingATranslationDeletesOnlyTheTranslationByExtbase (Failure without skip)
Assertion in data-set failed for "tx_extbasefacts_domain_model_item:1":
Fields |Assertion |Record
deleted|0         |1
tstamp |1500000000|1700000000

Assertion in data-set failed for "tx_extbasefacts_domain_model_item:2":
Fields |Assertion |Record
deleted|1         |0
tstamp |1700000000|1500000000

Deleting a record deletes its inline children

Deviates

In 14.3

Core: Item 1 with the notes 1 and 2 in an inline field is deleted through DataHandler. DataHandler marks both notes deleted together with the item.

Extbase: Extbase marks only the item deleted. Both notes keep deleted 0 and their old tstamp, because the property holding them is not mapped with cascade remove.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:212 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:234 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedRecordWithNotes.csv (local)
SkipExtbase differs from core: it leaves the inline children undeleted unless the property is mapped with cascade remove.
TestDeletingTest::deletingARecordDeletesItsInlineChildrenByExtbase (Failure without skip)
Assertion in data-set failed for "tx_extbasefacts_domain_model_note:1":
Fields |Assertion |Record
deleted|1         |0
tstamp |1700000000|1500000000

Assertion in data-set failed for "tx_extbasefacts_domain_model_note:2":
Fields |Assertion |Record
deleted|1         |0
tstamp |1700000000|1500000000

Deleting a record deletes its inline children with cascade remove

Same as core

In 14.3

Core: Item 1 with the notes 1 and 2 in a second inline field is deleted through DataHandler. DataHandler marks both notes deleted together with the item, no matter how the property is mapped in Extbase.

Extbase: Extbase marks the item and both notes deleted, because the property holding the notes is mapped with cascade remove.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:257 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:279 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedRecordWithCascadedNotes.csv (local)

A record without delete column is removed

Same as core

In 14.3

Core: A record of a table without delete column is deleted through DataHandler. DataHandler removes the row from the table.

Extbase: Extbase removes the row from the table, like DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:299 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:321 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/RemovedPlainRecord.csv (local)

Mm rows of a removed record

Same as core

In 14.3

Core: A record of a table without delete column and with the tags 1 and 2 is deleted through DataHandler. DataHandler removes the row and its two rows in the relation table; the tags stay.

Extbase: Extbase removes the row and its two rows in the relation table, like DataHandler; the tags stay.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:341 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:363 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/RemovedPlainRecordWithTags.csv (local)

Mm rows of a soft deleted record

Same as core

In 14.3

Core: Item 1 with the tags 1 and 2 is deleted through DataHandler. DataHandler marks the item deleted and keeps its two rows in the relation table.

Extbase: Extbase marks the item deleted and keeps its two rows in the relation table, like DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:383 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:405 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/DeletedRecordWithTags.csv (local)

Removing a child from the parent

Deviates

In 14.3

Core: An editor removes the note 1 from the inline field of item 1 in the backend form. The form sends the remaining list with the note 2 as the only entry in the datamap and a delete command for the note 1 in the cmdmap, and DataHandler processes both in one run. DataHandler marks the note 1 deleted with the current tstamp; its field pointing to the item keeps the uid. The counter of the field drops to 1 and the tstamp of the item and of the note 2 is set to the current time.

Extbase: Extbase does not delete the note 1. It detaches it: deleted stays 0 and its field pointing to the item is set to 0, so the note stays in the table as an orphan. The counter of the field drops to 1 and the tstamp of the item is set to the current time; the note 2 stays untouched.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:425 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/DeletingTest.php:450 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Deleting/RemovedNoteFromItem.csv (local)
SkipExtbase differs from core: it detaches the removed child from the parent instead of deleting it.
TestDeletingTest::removingAChildFromTheParentByExtbase (Failure without skip)
Assertion in data-set failed for "tx_extbasefacts_domain_model_note:1":
Fields |Assertion|Record
item   |1        |0
deleted|1        |0

Assertion in data-set failed for "tx_extbasefacts_domain_model_note:2":
Fields|Assertion |Record
tstamp|1700000000|1500000000