Project

General

Profile

Actions

Bug #22535

closed

Deleting the parent record leaves orphan child records

Added by Boros Attila over 14 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2010-04-28
Due date:
% Done:

0%

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

Description

I'm using IRRE for 1:n relations and m:n relations with an intermediate table. In both cases deleting the parent record leaves orphan child records. I have tried to fix this by adding foreign keys with ON DELETE CASCADE but after cat I couldn't create new records. An error message 2: SQL error: '' () appears on top of the page in a red box when I try. I guess IRRE tries to save the child record first, before the parent is created.

Having foreign keys would be really nice, but at least IRRE should also delete the child records when their parent is deleted. Until this gets fixed, is there a way I could use some hook to delete the child records manually as a workaround?

(issue imported from #M14233)


Related issues 1 (1 open0 closed)

Is duplicate of TYPO3 Core - Bug #79014: DataHandler not deleting inline and MM references if base table does not have a "delete"-field leads to DatabaseRecordException⁠⁠⁠⁠Under ReviewStephan Großberndt2016-12-16

Actions
Actions #1

Updated by Alexander Stehlik about 12 years ago

  • Target version deleted (0)

I had the same problem that Boros described.

I investigated a bit further and I think I found the problem:

When you look at t3lib_TCEmain::deleteRecord() you can see that when a delete row is configured ($GLOBALS['TCA'][$table]['ctrl']['delete']) in the TCA the child records will be deleted by:

$this->deleteRecord_procFields($table, $uid, $undeleteRecord);

But when the records are directly deleted without setting a "deleted" flag or the $forceHardDelete parameter is TRUE this method (deleteRecord_procFields) will never be called and the child records stay in the database.

I don't know if this is expected behaviour or if it is a bug. If it is expected, it would be great to get an explanation, why.

Actions #2

Updated by Stanislas Rolland over 11 years ago

  • Category set to 978
Actions #3

Updated by Mathias Schreiber almost 10 years ago

  • Target version set to 7.4 (Backend)
  • Is Regression set to No
Actions #4

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #5

Updated by Benni Mack about 9 years ago

  • Target version deleted (7.5)
Actions #6

Updated by Markus Klein over 5 years ago

  • Is duplicate of Bug #79014: DataHandler not deleting inline and MM references if base table does not have a "delete"-field leads to DatabaseRecordException⁠⁠⁠⁠ added
Actions #7

Updated by Markus Klein over 5 years ago

  • Status changed from New to Closed

Is handled with #79014

Actions

Also available in: Atom PDF