You are here

protected function ConfigImporterService::import in Config Importer and Tools 8

Same name and namespace in other branches
  1. 8.2 src/ConfigImporterService.php \Drupal\config_import\ConfigImporterService::import()
  2. 8.0 src/ConfigImporterService.php \Drupal\config_import\ConfigImporterService::import()

Import configurations from files storage.

Parameters

FileStorage $storage: A storage to import from.

1 call to ConfigImporterService::import()
ConfigImporterService::importConfigs in src/ConfigImporterService.php
Import configurations.

File

src/ConfigImporterService.php, line 301

Class

ConfigImporterService
Class ConfigImporterService.

Namespace

Drupal\config_import

Code

protected function import(FileStorage $storage) {
  $storage_comparer = new StorageComparer($storage, $this->configStorage, $this->configManager);
  if (!$storage_comparer
    ->createChangelist()
    ->hasChanges()) {
    return;
  }
  $config_importer = new ConfigImporter($storage_comparer, $this->eventDispatcher, $this->configManager, $this->lock, $this->configTyped, $this->moduleHandler, $this->moduleInstaller, $this->themeHandler, $this->translationManager);
  try {
    $config_importer
      ->validate()
      ->import();
  } catch (ConfigException $e) {
    throw new ConfigImporterException(implode("\n", $config_importer
      ->getErrors()));
  }
}