class ReadOnlyStorage
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Config/ReadOnlyStorage.php \Drupal\Core\Config\ReadOnlyStorage
- 10 core/lib/Drupal/Core/Config/ReadOnlyStorage.php \Drupal\Core\Config\ReadOnlyStorage
- 11.x core/lib/Drupal/Core/Config/ReadOnlyStorage.php \Drupal\Core\Config\ReadOnlyStorage
A ReadOnlyStorage decorates a storage and does not allow writing to it.
Hierarchy
- class \Drupal\Core\Config\ReadOnlyStorage implements \Drupal\Core\Config\StorageInterface
Expanded class hierarchy of ReadOnlyStorage
1 file declares its use of ReadOnlyStorage
- ReadOnlyStorageTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ ReadOnlyStorageTest.php
File
-
core/
lib/ Drupal/ Core/ Config/ ReadOnlyStorage.php, line 8
Namespace
Drupal\Core\ConfigView source
class ReadOnlyStorage implements StorageInterface {
/**
* The config storage that we are decorating.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $storage;
/**
* Create a ReadOnlyStorage decorating another storage.
*
* @param \Drupal\Core\Config\StorageInterface $storage
* The decorated storage.
*/
public function __construct(StorageInterface $storage) {
$this->storage = $storage;
}
/**
* {@inheritdoc}
*/
public function exists($name) {
return $this->storage
->exists($name);
}
/**
* {@inheritdoc}
*/
public function read($name) {
return $this->storage
->read($name);
}
/**
* {@inheritdoc}
*/
public function readMultiple(array $names) {
return $this->storage
->readMultiple($names);
}
/**
* {@inheritdoc}
*/
public function write($name, array $data) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
/**
* {@inheritdoc}
*/
public function delete($name) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
/**
* {@inheritdoc}
*/
public function rename($name, $new_name) {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
/**
* {@inheritdoc}
*/
public function encode($data) {
return $this->storage
->encode($data);
}
/**
* {@inheritdoc}
*/
public function decode($raw) {
return $this->storage
->decode($raw);
}
/**
* {@inheritdoc}
*/
public function listAll($prefix = '') {
return $this->storage
->listAll($prefix);
}
/**
* {@inheritdoc}
*/
public function deleteAll($prefix = '') {
throw new \BadMethodCallException(__METHOD__ . ' is not allowed on a ReadOnlyStorage');
}
/**
* {@inheritdoc}
*/
public function createCollection($collection) {
return new static($this->storage
->createCollection($collection));
}
/**
* {@inheritdoc}
*/
public function getAllCollectionNames() {
return $this->storage
->getAllCollectionNames();
}
/**
* {@inheritdoc}
*/
public function getCollectionName() {
return $this->storage
->getCollectionName();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ReadOnlyStorage::$storage | protected | property | The config storage that we are decorating. | |
ReadOnlyStorage::createCollection | public | function | Creates a collection on the storage. | Overrides StorageInterface::createCollection |
ReadOnlyStorage::decode | public | function | Decodes configuration data from the storage-specific format. | Overrides StorageInterface::decode |
ReadOnlyStorage::delete | public | function | Deletes a configuration object from the storage. | Overrides StorageInterface::delete |
ReadOnlyStorage::deleteAll | public | function | Deletes configuration objects whose names start with a given prefix. | Overrides StorageInterface::deleteAll |
ReadOnlyStorage::encode | public | function | Encodes configuration data into the storage-specific format. | Overrides StorageInterface::encode |
ReadOnlyStorage::exists | public | function | Returns whether a configuration object exists. | Overrides StorageInterface::exists |
ReadOnlyStorage::getAllCollectionNames | public | function | Gets the existing collections. | Overrides StorageInterface::getAllCollectionNames |
ReadOnlyStorage::getCollectionName | public | function | Gets the name of the current collection the storage is using. | Overrides StorageInterface::getCollectionName |
ReadOnlyStorage::listAll | public | function | Gets configuration object names starting with a given prefix. | Overrides StorageInterface::listAll |
ReadOnlyStorage::read | public | function | Reads configuration data from the storage. | Overrides StorageInterface::read |
ReadOnlyStorage::readMultiple | public | function | Reads configuration data from the storage. | Overrides StorageInterface::readMultiple |
ReadOnlyStorage::rename | public | function | Renames a configuration object in the storage. | Overrides StorageInterface::rename |
ReadOnlyStorage::write | public | function | Writes configuration data to the storage. | Overrides StorageInterface::write |
ReadOnlyStorage::__construct | public | function | Create a ReadOnlyStorage decorating another storage. | |
StorageInterface::DEFAULT_COLLECTION | constant | The default collection name. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.