Add a config storage copy utility trait and fix ConfigManager::createSnapshot

Created on 27 November 2018, almost 6 years ago
Updated 14 September 2023, about 1 year ago

Problem/Motivation

We need a standardized and complete way to copy config between two config storages.
Many tools such as drush and drupal console and also a couple of modules do this all in their own way now and some do it in a incomplete fashion that may lead to strange behaviour in edge cases.

Examples in core:
\Drupal\Core\Config\ConfigManager::createSnapshot misbehaves badly when storages are not in default collection.
\Drupal\Tests\ConfigTestTrait::copyConfig ignores collections (so all tests based on this also ignore collections.)

related bug in drush: https://github.com/drush-ops/drush/issues/3572
related bug in drupal console: https://github.com/hechoendrupal/drupal-console/issues/1736

Modules implementing this logic on their own: config_split, config_sync, config_owner (and for sure a couple more)

Proposed resolution

Add a utility trait to copy config between storages which also takes care of collections.

Remaining tasks

port code from #2991683: Move configuration transformation API in \Drupal\Core\Config namespace β†’
review
commit

User interface changes

none

API changes

todo

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

8.7 ⚰️

Component
ConfigurationΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¨πŸ‡­Switzerland bircher πŸ‡¨πŸ‡Ώ

Live updates comments and jobs are added and updated live.
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