function StorageComparer::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::__construct()
  2. 10 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::__construct()
  3. 11.x core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::__construct()

Constructs the Configuration storage comparer.

Parameters

\Drupal\Core\Config\StorageInterface $source_storage: Storage object used to read configuration.

\Drupal\Core\Config\StorageInterface $target_storage: Storage object used to write configuration.

\Drupal\Core\Config\ConfigManagerInterface $config_manager: (deprecated) The configuration manager. The $config_manager parameter is deprecated since version 8.7.0 and will be removed in 9.0.0.

File

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

Class

StorageComparer
Defines a config storage comparer.

Namespace

Drupal\Core\Config

Code

public function __construct(StorageInterface $source_storage, StorageInterface $target_storage, ConfigManagerInterface $config_manager = NULL) {
    // Wrap the storages in a static cache so that multiple reads of the same
    // raw configuration object are not costly.
    $this->sourceCacheStorage = new MemoryBackend();
    $this->sourceStorage = new CachedStorage($source_storage, $this->sourceCacheStorage);
    $this->targetCacheStorage = new MemoryBackend();
    $this->targetStorage = new CachedStorage($target_storage, $this->targetCacheStorage);
    $this->changelist[StorageInterface::DEFAULT_COLLECTION] = $this->getEmptyChangelist();
    if ($config_manager !== NULL) {
        @trigger_error('The storage comparer does not need a config manager. The parameter is deprecated since version 8.7.0 and will be removed in 9.0.0. Omit the third parameter. See https://www.drupal.org/node/2993271.', E_USER_DEPRECATED);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.