public function ExportStorageManager::getStorage in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/ExportStorageManager.php \Drupal\Core\Config\ExportStorageManager::getStorage()
Get the config storage.
Return value
\Drupal\Core\Config\StorageInterface The config storage.
Throws
\Drupal\Core\Config\StorageTransformerException Thrown when the lock could not be acquired.
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\ConfigCode
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);
}