You are here

protected function StorageComparer::getAndSortConfigData in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::getAndSortConfigData()
  2. 10 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::getAndSortConfigData()

Gets and sorts configuration data from the source and target storages.

1 call to StorageComparer::getAndSortConfigData()
StorageComparer::createChangelist in core/lib/Drupal/Core/Config/StorageComparer.php

File

core/lib/Drupal/Core/Config/StorageComparer.php, line 399

Class

StorageComparer
Defines a config storage comparer.

Namespace

Drupal\Core\Config

Code

protected function getAndSortConfigData($collection) {
  $source_storage = $this
    ->getSourceStorage($collection);
  $target_storage = $this
    ->getTargetStorage($collection);
  $target_names = $target_storage
    ->listAll();
  $source_names = $source_storage
    ->listAll();

  // Prime the static caches by reading all the configuration in the source
  // and target storages.
  $target_data = $target_storage
    ->readMultiple($target_names);
  $source_data = $source_storage
    ->readMultiple($source_names);

  // If the collection only supports simple configuration do not use
  // configuration dependencies.
  if ($collection == StorageInterface::DEFAULT_COLLECTION) {
    $dependency_manager = new ConfigDependencyManager();
    $this->targetNames[$collection] = $dependency_manager
      ->setData($target_data)
      ->sortAll();
    $this->sourceNames[$collection] = $dependency_manager
      ->setData($source_data)
      ->sortAll();
  }
  else {
    $this->targetNames[$collection] = $target_names;
    $this->sourceNames[$collection] = $source_names;
  }
}