diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 422c13f..64f42b7 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -346,15 +346,14 @@ public function save(EntityInterface $entity) { $id = $entity->getOriginalId(); } $config = $this->configFactory->get($prefix . $id); - $is_new = $config->isNew(); // If the entity is new but a config file for it already exists, prevent // it to be overwritten. - if ($entity->isNew() && !$is_new) { + if ($entity->isNew() && !$config->isNew()) { throw new EntityStorageException(String::format('@type entity with ID @id already exists.', array('@type' => $this->entityType, '@id' => $id))); } - if (!$is_new && !isset($entity->original)) { + if (!$config->isNew() && !isset($entity->original)) { $this->resetCache(array($id)); $entity->original = $this->load($id); }