You are here

function address_update_8103 in Address 8

Remove the stored zones.

File

./address.install, line 197
Requirements and update functions for the address module.

Code

function address_update_8103() {

  // Clear the caches to ensure the entity type is gone.
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  \Drupal::service('entity_type.repository')
    ->clearCachedDefinitions();

  // Remove the underlying config.
  $config_factory = \Drupal::configFactory();
  $names = $config_factory
    ->listAll('address.zone.');
  foreach ($names as $name) {
    $config_factory
      ->getEditable($name)
      ->delete();
  }
}