Bug #101522
closed\TYPO3\CMS\Core\Database\RelationHandler::purgeItemArray only works with workspaces enabled
0%
Description
I have the following situation: I want to use the datahandler to delete records in the backend via command map delete.
I have table a, table b and table a_b_mm:
uid | name |
---|---|
1 | A |
uid | name |
---|---|
1 | B |
uid_local | uid_foreign |
---|---|
1 | 1 |
When deleting either record A or B with uid 1, I expect the data handler to remove the entry in the mm table.
\TYPO3\CMS\Core\DataHandling\DataHandler::deleteRecord()
calls\TYPO3\CMS\Core\DataHandling\DataHandler::deleteRecord_procFields()
which states:
* Before a record is deleted, check if it has references such as inline type or MM references. * If so, set these child records also to be deleted.
Therefore, I was under the impression that mm entries would be removed but it seems that the RelationHandler
only removes the identified rows (\TYPO3\CMS\Core\Database\RelationHandler::purgeItemArrayHandler()
) if workspaces are enabled.
However, I would expect the DataHandler
to clean up also records without workspaces enabled.
I checked if the behavior is the same in the backend and it is. Deleting a record via list module does not remove the associated mm entry.
Updated by Christian Kuhn 11 days ago
- Status changed from New to Closed
Yes: When deleting soft-delete aware local or foreign side of an MM record, the MM rows are kept: Removing MM rows when setting deleted=1 for foreign or local side directly would make undelete impossible. "True" MM tables have no deleted field, the relation information can only be removed if either side row is fully removed from DB.
I hope I understood your issue correctly and came up with a good reason of current behavior. I'll close here for now. Feel free to reopen in case I got this wrong, maybe add some TCA and more how-to-reproduce if in doubt.
Updated by Alexander Schnitzler 11 days ago
Due to its age, I cannot say for sure but I think I encountered this issue with not using the deleted flag on records.
Keeping the mm record to be able to undelete makes sense. Without it, I'd argue differently.