Issue Bug Under Review

#111479DataHandler does not recount parent counter field after deleting inline child

Benjamin Kott 11/17/26, 17:20 updated 11/17/26, 17:20

Description

Problem

When an inline child that points to its parent by foreign_field (for example a sys_file_reference of tt_content.image) is deleted by a delete command, the counter field of the parent keeps the old number of children. Translations of the child are deleted along, and the counter field of their translated parent is not updated either.

In the record form, the default language parent shows the correct value only because the parent is saved in the same request and its field is rewritten. Its translation keeps the stale count. A delete command on its own, for instance from the list module or the API, leaves the counter of both parents stale.

Steps to reproduce

  1. Create a content element with two images and translate it, so that its translation has two translated file references.
  2. Delete the first file reference of the default language element by a DataHandler command: $cmd[‘sys_file_reference’][<uid>][‘delete’] = 1</uid>
  3. Look at the field image of the default language element and of its translation in the database: both still contain 2, although only one file reference is left on each.

Cause

DataHandler::deleteAction() and DataHandler::deleteRecord() only mark the child as deleted. Unlike the localize and synchronize path, which recounts the field with RelationHandler::countItems(), nothing writes the counter field of the parent the child points to. DataHandler::deleteL10nOverlayRecords() deletes the translations of the child the same way.

Reviews 1

History 01