diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php index d23341b..81f5591 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php @@ -248,9 +248,7 @@ protected function doSave($id, EntityInterface $entity) { } // Retrieve the desired properties and set them in config. - foreach ($entity->toArray() as $key => $value) { - $config->set($key, $value); - } + $config->setData($entity->toArray()); $config->save(); return $is_new ? SAVED_NEW : SAVED_UPDATED; diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index 37019f5..6dc8a44 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -242,8 +242,8 @@ public function testSaveInsert(EntityInterface $entity) { $config_object->expects($this->atLeastOnce()) ->method('isNew') ->will($this->returnValue(TRUE)); - $config_object->expects($this->exactly(4)) - ->method('set'); + $config_object->expects($this->once()) + ->method('setData'); $config_object->expects($this->once()) ->method('save'); @@ -301,8 +301,8 @@ public function testSaveUpdate(EntityInterface $entity) { $config_object->expects($this->atLeastOnce()) ->method('isNew') ->will($this->returnValue(FALSE)); - $config_object->expects($this->exactly(4)) - ->method('set'); + $config_object->expects($this->once()) + ->method('setData'); $config_object->expects($this->once()) ->method('save'); @@ -361,8 +361,8 @@ public function testSaveRename(ConfigEntityInterface $entity) { $config_object->expects($this->atLeastOnce()) ->method('isNew') ->will($this->returnValue(FALSE)); - $config_object->expects($this->exactly(4)) - ->method('set'); + $config_object->expects($this->once()) + ->method('setData'); $config_object->expects($this->once()) ->method('save');