Commit 56580a39 authored by webchick's avatar webchick

Issue #1889854 by tim.plunkett: Fixed Config import breaks on protected entity properties.

parent a1ce6942
......@@ -470,11 +470,11 @@ public function importChange($name, Config $new_config, Config $old_config) {
$entity->original = clone $entity;
foreach ($old_config->get() as $property => $value) {
$entity->original->$property = $value;
$entity->original->set($property, $value);
}
foreach ($new_config->get() as $property => $value) {
$entity->$property = $value;
$entity->set($property, $value);
}
$entity->save();
......
......@@ -108,6 +108,7 @@ function testNew() {
'label' => 'New',
'style' => '',
'langcode' => 'und',
'protected_property' => '',
);
$staging->write($dynamic_name, $original_dynamic_data);
......
......@@ -60,6 +60,7 @@ function testImport() {
'label' => 'New',
'style' => '',
'langcode' => 'und',
'protected_property' => '',
);
$staging->write($dynamic_name, $original_dynamic_data);
......
......@@ -62,4 +62,25 @@ class ConfigTest extends ConfigEntityBase {
*/
public $style;
/**
* A protected property of the configuration entity.
*
* @var string
*/
protected $protected_property;
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
$protected_names = array(
'protected_property',
);
foreach ($protected_names as $name) {
$properties[$name] = $this->get($name);
}
return $properties;
}
}
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