Calling EntityConfig::import() with multiple destination IDs fails

Created on 6 March 2020, over 4 years ago
Updated 6 November 2024, 15 days ago

Problem/Motivation

EntityConfigBase migrations cannot update existing configs due to the lack of an appropriate getEntity implementation.

It defaults to Entity:getEntity which only takes into account the first destination id, however configs typically have multiple IDs which should be concatenated by a ..

This means that in every destination plugin which overrides EntityConfigBase (and do not override the import method), if the Drupal\migrate\Plugin::import() method is called with a non-empty $old_destination_ids param, the import process will fail, because instead of operating on a preexisting entity, the destination plugin tries to create a new one (with the same ID which was calculated based on the destination IDs of the current migration Row).

Affected destination plugins are e.g.

  • entity:field_config
  • entity:field_storage_config
  • entity:base_field_override
  • entity:block

Proposed resolution

Implement appropriate getEntity which takes into account the full config ID.

Remaining tasks

  • Add a test for the abstract EntityConfigBase migrate destination plugin class
  • Implement a BC-safe fix.

User interface changes

N/A

API changes

N/A

Side effects

The current EntityConfigBase makes it impossible to track changes of migrations with multi-ID config entity destinations, but this is not evaluated as a bug.

Fixing the issue will make change tracking possible in these scenarios.

Feature request
Status

Needs work

Version

11.0 🔥

Component

migration system

Created by

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

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