Bug #76138

Inline Relations - Delete Behaviour with mixed Usage of the Deleted Flag

Added by Stephan Ude about 3 years ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Start date:
2016-05-11
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

I am using TYPO3 6.2 (latest from git) but I guess this issue persists also in later versions.

Having a parent record which uses no deleted flag in the database (TCA ctrl > delete not set) results in actually deleting database entries on deletion in the backend.
If this parent record has an inline relation to a record which does use the deleted flag, it results in an odd behaviour on deletion of the parent record: The child records do not get deleted in the database and neither get the deleted flag set.

Apart from having dead entries (which are not marked as deleted) in the database this results in another problem when using translations. Consider the following scenario:

1.) Create a parent record.
2.) Create a child record as inline relation for the parent.
3.) Localise the parent record. The child record gets localised along with it automatically (in my example TCA, otherwise you can do it manually).
4.) Delete the translated parent record. Now the translated child records still exist (undeleted) in the database.
5.) Localise the parent record again. The localisation of the child record (no matter if automatically or manually) will fail because there is a localisation already in the database.

I will attach a little example extension with which you can reproduce the scenario. It uses FAL references for the inline relation.

About the desired behaviour:

At least the deleted flag should be set in the child records upon deletion of the parent record.
But since the parent record does not exist anymore, it could also make sense to ignore the deleted flag of the child record and also remove it completely from the database. It just has no reference anymore.

The problem seems to lie within TYPO3\CMS\Core\DataHandling\DataHandler::deleteRecord() but I am not sure how to approach this issue best.

inlinetest_1.0.0_201605111050.zip (509 KB) Stephan Ude, 2016-05-11 10:55

History

#1 Updated by Christian Kuhn about 3 years ago

First: Thanks for a very good issue explanation and for the test extension!

I'll in the currently ongoing sprint in cluj if anyone could transfer your test extension as test bed to ext:styleguide - this is our main tca test extension for such cases.

#2 Updated by Christian Kuhn about 3 years ago

tx_styleguide_inline_parentnosoftdelete

#3 Updated by Markus Klein about 3 years ago

  • Category set to DataHandler aka TCEmain
  • Status changed from New to Accepted
  • Target version set to Candidate for patchlevel
  • Complexity set to medium
  • Sprint Focus set to On Location Sprint

#4 Updated by Anja Leichsenring about 3 years ago

the PR has been accepted to ext:styleguide, and the version requirement has been raised for the core. So the test bed is now available in current core. Table is tx_styleguide_inline_parentnosoftdelete.

#5 Updated by Gerrit Code Review about 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48101

#6 Updated by Gerrit Code Review about 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48101

#7 Updated by Christian Kuhn about 3 years ago

  • Sprint Focus deleted (On Location Sprint)

#8 Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48101

#9 Updated by Benni Mack 7 months ago

  • Status changed from Under Review to New

Also available in: Atom PDF