function ExportStorageManager::getStorage

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/ExportStorageManager.php \Drupal\Core\Config\ExportStorageManager::getStorage()
  2. 10 core/lib/Drupal/Core/Config/ExportStorageManager.php \Drupal\Core\Config\ExportStorageManager::getStorage()
  3. 11.x core/lib/Drupal/Core/Config/ExportStorageManager.php \Drupal\Core\Config\ExportStorageManager::getStorage()

Overrides StorageManagerInterface::getStorage

File

core/lib/Drupal/Core/Config/ExportStorageManager.php, line 77

Class

ExportStorageManager
The export storage manager dispatches an event for the export storage.

Namespace

Drupal\Core\Config

Code

public function getStorage() {
    // Acquire a lock for the request to assert that the storage does not change
    // when a concurrent request transforms the storage.
    if (!$this->lock
        ->acquire(self::LOCK_NAME)) {
        $this->lock
            ->wait(self::LOCK_NAME);
        if (!$this->lock
            ->acquire(self::LOCK_NAME)) {
            throw new StorageTransformerException("Cannot acquire config export transformer lock.");
        }
    }
    self::replaceStorageContents($this->active, $this->storage);
    $this->eventDispatcher
        ->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT);
    return new ReadOnlyStorage($this->storage);
}

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