You are here

private function ConfigSplitCliService::import in Configuration Split 2.0.x

Same name and namespace in other branches
  1. 8 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::tryImport in src/ConfigSplitCliService.php
Try importing the storage.

File

src/ConfigSplitCliService.php, line 286

Class

ConfigSplitCliService
The CLI service class for interoperability.

Namespace

Drupal\config_split

Code

private function import(StorageInterface $storage) {
  $comparer = new StorageComparer($storage, $this->activeStorage);
  if (!$comparer
    ->createChangelist()
    ->hasChanges()) {
    return static::NO_CHANGES;
  }
  $importer = $this
    ->getConfigImporterFromComparer($comparer);
  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;
}