Project

General

Profile

Actions

Bug #79014

open

DataHandler not deleting inline and MM references if base table does not have a "delete"-field leads to DatabaseRecordException⁠⁠⁠⁠

Added by Stephan Großberndt over 7 years ago. Updated about 1 year ago.

Status:
Under Review
Priority:
Must have
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2016-12-16
Due date:
% Done:

0%

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

Description

DataHandler calls deleteRecord_procFields() to check and delete inline and MM references only if the base table has a "delete"-field:

        if ($deleteField && !$forceHardDelete) {
            ...

            // before (un-)deleting this record, check for child records or references
            $this->deleteRecord_procFields($table, $uid, $undeleteRecord);
            $this->databaseConnection->exec_UPDATEquery($table, 'uid=' . (int)$uid, $updateFields);
            // Delete all l10n records as well, impossible during undelete because it might bring too many records back to life
            if (!$undeleteRecord) {
                $this->deleteL10nOverlayRecords($table, $uid);
            }
        } else {
            ...

            // Delete the hard way...:
            $this->databaseConnection->exec_DELETEquery($table, 'uid=' . (int)$uid);
            $this->deleteL10nOverlayRecords($table, $uid);
        }

This is wrong. If a table does not contain a defined "delete"-field in TCA and has inline or MM-relations and a record from this table is deleted, the related and mm records stay in the database.

If you try to open the record on the other side of the mm-relation you get a ⁠⁠⁠⁠DatabaseRecordException⁠⁠⁠⁠ with ⁠⁠⁠⁠#1437656081: Record with uid XXX from table tx_extension_mytable not found⁠⁠⁠⁠ because the relation in the mm table is still there but the record is not.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #76138: Inline Relations - Delete Behaviour with mixed Usage of the Deleted FlagNew2016-05-11

Actions
Has duplicate TYPO3 Core - Bug #22535: Deleting the parent record leaves orphan child recordsClosed2010-04-28

Actions
Actions

Also available in: Atom PDF