Last active
May 7, 2024 16:52
-
-
Save slattery/16f28440e87dc65f4d83a8e208a79ee4 to your computer and use it in GitHub Desktop.
d10_config_importer_entitycheck_b4_delete.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php | |
index 18f7a0c..b0c60d7 100644 | |
--- a/ConfigImporter.php | |
+++ b/ConfigImporter.php | |
@@ -10,6 +10,7 @@ use Drupal\Core\Extension\ThemeExtensionList; | |
use Drupal\Core\Extension\ThemeHandlerInterface; | |
use Drupal\Core\Config\Entity\ImportableEntityStorageInterface; | |
use Drupal\Core\DependencyInjection\DependencySerializationTrait; | |
+use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Entity\EntityStorageException; | |
use Drupal\Core\Lock\LockBackendInterface; | |
use Drupal\Core\StringTranslation\StringTranslationTrait; | |
@@ -947,8 +948,10 @@ class ConfigImporter { | |
$entity_storage = $this->configManager->getEntityTypeManager()->getStorage($entity_type_id); | |
$entity_type = $this->configManager->getEntityTypeManager()->getDefinition($entity_type_id); | |
$entity = $entity_storage->load($entity_storage->getIDFromConfigName($name, $entity_type->getConfigPrefix())); | |
- $entity->delete(); | |
- $this->logError($this->t('Deleted and replaced configuration entity "@name"', ['@name' => $name])); | |
+ if ($entity instanceof EntityInterface) { | |
+ $entity->delete(); | |
+ $this->logError($this->t('Deleted and replaced configuration entity "@name"', ['@name' => $name])); | |
+ } | |
} | |
else { | |
$this->storageComparer->getTargetStorage($collection)->delete($name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment