You are here

public function ConfigSplitCliService::import in Configuration Split 8

Same name and namespace in other branches
  1. 2.0.x src/ConfigSplitCliService.php \Drupal\config_split\ConfigSplitCliService::import()

Import the configuration.

This is the quintessential config import.

Parameters

\Drupal\Core\Config\StorageInterface $storage: The config storage to import from.

Return value

string The state of importing.

1 call to ConfigSplitCliService::import()
ConfigSplitCliService::ioImport in src/ConfigSplitCliService.php
Handle the import interaction.

File

src/ConfigSplitCliService.php, line 319

Class

ConfigSplitCliService
The CLI service class for interoperability.

Namespace

Drupal\config_split

Code

public function import(StorageInterface $storage) {
  $comparer = new StorageComparer($storage, $this->activeStorage);
  if (!$comparer
    ->createChangelist()
    ->hasChanges()) {
    return static::NO_CHANGES;
  }
  $importer = new ConfigImporter($comparer, $this->eventDispatcher, $this->configManager, $this->lock, $this->configTyped, $this->moduleHandler, $this->moduleInstaller, $this->themeHandler, $this->stringTranslation, $this->moduleExtensionList);
  if ($importer
    ->alreadyImporting()) {
    return static::ALREADY_IMPORTING;
  }
  try {

    // Do the import with the ConfigImporter.
    $importer
      ->import();
  } catch (ConfigImporterException $e) {

    // Catch and re-trow the ConfigImporterException.
    $this->errors = $importer
      ->getErrors();
    throw $e;
  }
  return static::COMPLETE;
}