Bug #22535

Deleting the parent record leaves orphan child records

Added by Boros Attila about 9 years ago. Updated almost 4 years ago.

Should have
FormEngine aka TCEforms
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


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)


#1 Updated by Alexander Stehlik over 6 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.

#2 Updated by Stanislas Rolland over 6 years ago

  • Category set to 978

#3 Updated by Mathias Schreiber over 4 years ago

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

#4 Updated by Susanne Moog almost 4 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#5 Updated by Benni Mack almost 4 years ago

  • Target version deleted (7.5)

Also available in: Atom PDF