final class ImportStorageTransformer (View source)

The import storage transformer helps to use the configuration management api.

This service does not implement an interface and is final because it is not meant to be replaced, extended or used in a different context. Its single purpose is to transform a storage for the import step of a configuration synchronization by dispatching the import transformation event.

Traits

Utility trait to copy configuration from one storage to another.

Constants

LOCK_NAME

The name used to identify the lock.

Properties

protected EventDispatcherInterface $eventDispatcher

The event dispatcher to get changes to the configuration.

protected Connection $connection

The drupal database connection.

protected LockBackendInterface $requestLock

The normal lock for the duration of the request.

protected LockBackendInterface $persistentLock

The persistent lock which the config importer uses across requests.

Methods

static 
replaceStorageContents(StorageInterface $source, StorageInterface $target)

Copy the configuration from one storage to another and remove stale items.

__construct(EventDispatcherInterface $event_dispatcher, Connection $connection, LockBackendInterface $requestLock, LockBackendInterface $persistentLock)

ImportStorageTransformer constructor.

transform(StorageInterface $storage)

Transform the storage to be imported from.

Details

static protected replaceStorageContents(StorageInterface $source, StorageInterface $target)

Copy the configuration from one storage to another and remove stale items.

This method empties target storage and copies all collections from source. Configuration is only copied and not imported, should not be used with the active storage as the target.

Parameters

StorageInterface $source

The configuration storage to copy from.

StorageInterface $target

The configuration storage to copy to.

__construct(EventDispatcherInterface $event_dispatcher, Connection $connection, LockBackendInterface $requestLock, LockBackendInterface $persistentLock)

ImportStorageTransformer constructor.

Parameters

EventDispatcherInterface $event_dispatcher

The event dispatcher.

Connection $connection

The database connection.

LockBackendInterface $requestLock

The lock for the request.

LockBackendInterface $persistentLock

The persistent lock used by the config importer.

StorageInterface transform(StorageInterface $storage)

Transform the storage to be imported from.

An import transformation is done before the config importer uses the storage to synchronize the configuration. The transformation is also done for displaying differences to review imports. Importing in this context means the active drupal configuration is changed with the ConfigImporter which may or may not be as part of the config synchronization.

Parameters

StorageInterface $storage

The storage to transform for importing from it.

Return Value

StorageInterface

The transformed storage ready to be imported from.

Exceptions

StorageTransformerException