Commit 1c179cb7 authored by bircher's avatar bircher

Issue #3117135 by claudiu.cristea, mpp: TypeError: Argument 1 passed to...

Issue #3117135 by claudiu.cristea, mpp: TypeError: Argument 1 passed to NestedArray::unsetValue() must be of the type array, null given
parent 498063a9
......@@ -106,7 +106,7 @@ class ConfigIgnoreEventSubscriber implements EventSubscriberInterface {
* The active storage on import. The sync storage on export.
*/
protected function transformStorage(StorageInterface $transformation_storage, StorageInterface $destination_storage) {
$ignored_configs = $this->getIgnoredConfigs();
$ignored_configs = $this->getIgnoredConfigs($transformation_storage);
$collection_names = $transformation_storage->getAllCollectionNames();
array_unshift($collection_names, StorageInterface::DEFAULT_COLLECTION);
......@@ -147,9 +147,9 @@ class ConfigIgnoreEventSubscriber implements EventSubscriberInterface {
else {
$source_data = $transformation_storage->read($config_name);
foreach ($keys as $key) {
NestedArray::unsetValue($import_data, $key);
NestedArray::unsetValue($source_data, $key);
}
$transformation_storage->write($config_name, $import_data);
$transformation_storage->write($config_name, $source_data);
}
}
}
......@@ -159,6 +159,9 @@ class ConfigIgnoreEventSubscriber implements EventSubscriberInterface {
/**
* Returns the list of all ignored configs by expanding the wildcards.
*
* @param \Drupal\Core\Config\StorageInterface $transformation_storage
* The transformation config storage.
*
* @return array
* An associative array keyed by config name and having the values either
* NULL, if the whole config is ignored, or an array of keys to be ignored.
......@@ -173,7 +176,7 @@ class ConfigIgnoreEventSubscriber implements EventSubscriberInterface {
* ]
* @endcode
*/
protected function getIgnoredConfigs() {
protected function getIgnoredConfigs(StorageInterface $transformation_storage) {
/** @var string[] $ignored_configs_patterns */
$ignored_configs_patterns = $this->configFactory->get('config_ignore.settings')->get('ignored_config_entities');
$this->moduleHandler->invokeAll('config_ignore_settings_alter', [&$ignored_configs_patterns]);
......@@ -191,7 +194,7 @@ class ConfigIgnoreEventSubscriber implements EventSubscriberInterface {
}
$ignored_configs = [];
foreach ($this->configFactory->listAll() as $config_name) {
foreach ($transformation_storage->listAll() as $config_name) {
foreach ($ignored_configs_patterns as $ignored_config_pattern) {
if (strpos($ignored_config_pattern, ':') !== FALSE) {
// Some patterns are defining also a key.
......
......@@ -162,7 +162,9 @@ class ConfigIgnorePatternResolverTest extends UnitTestCase {
$configFactory = $this->prophesize(ConfigFactoryInterface::class);
$configFactory->get('config_ignore.settings')->willReturn($configIgnoreSettings->reveal());
$configFactory->listAll()->willReturn($all_configs);
$transformation_storage = $this->prophesize(StorageInterface::class);
$transformation_storage->listAll()->willReturn($all_configs);
$subscriber = new ConfigIgnoreEventSubscriber(
$configFactory->reveal(),
......@@ -176,7 +178,7 @@ class ConfigIgnorePatternResolverTest extends UnitTestCase {
$getIgnoredConfigsMethod = $class->getMethod('getIgnoredConfigs');
$getIgnoredConfigsMethod->setAccessible(TRUE);
return $getIgnoredConfigsMethod->invokeArgs($subscriber, []);
return $getIgnoredConfigsMethod->invokeArgs($subscriber, [$transformation_storage->reveal()]);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment