Inline Relations - Delete Behaviour with mixed Usage of the Deleted Flag
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.