Bad interaction between overwrite_properties and translation migrations. Introduce a new_translation_overwrite_all_properties option

Created on 22 January 2021, over 4 years ago
Updated 8 April 2025, 19 days ago

Problem

As stated in https://api.drupal.org/api/drupal/core!modules!migrate!src!Plugin!migrat...
when a migrate destination has overwrite_properties and the entity already exists only those properties specified are updated.
The problem I see is that when the destination is a translation the behavior is different from when is a new entity than when is a new translation for an existing entity. In summary, when a migration has translations as destination the overwrite_properties always kicks in when I feel the expected behavior for a new translation migration is that all the properties get saved and then further updates for that same translation respect the overwrite_properties option

Steps to reproduce

Create a migration with node translations as destination and set overwrite_properties to only the title.
Since titles can't be null the migration will always fail

Proposed resolution

Introduce a new_translation_overwrite_all_properties that is false by default and when set to true it mimics the behavior of a new entity import by ignoring overwrite_properties when the translation is new (the entity had no previous translations for that entity)

Remaining tasks

Add the code for the new option and test

User interface changes

None

API changes

New option for migrations

Data model changes

None

Release notes snippet

Introduce a new_translation_overwrite_all_properties option for migration of new translations.

📌 Task
Status

Needs work

Version

11.0 🔥

Component

migration system

Created by

🇪🇸Spain rodrigoaguilera Barcelona

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024