public function ConfigSnapshotServiceProvider::register in Config Snapshot 8
Registers services to the container.
Parameters
ContainerBuilder $container: The ContainerBuilder to register services to.
Overrides ServiceProviderBase::register
File
- src/
ConfigSnapshotServiceProvider.php, line 19
Class
- ConfigSnapshotServiceProvider
- Registers one service per config snapshot.
Namespace
Drupal\config_snapshotCode
public function register(ContainerBuilder $container) {
// @see Drupal\language\LanguageServiceProvider::isMultilingual()
// @todo Try to swap out for config.storage to take advantage of database
// and caching. This might prove difficult as this is called before the
// container has finished building.
$config_storage = BootstrapConfigStorageFactory::get();
$config_ids = $config_storage
->listAll(static::CONFIG_PREFIX);
foreach ($config_ids as $config_id) {
$snapshot = $config_storage
->read($config_id);
$container
->register("config_snapshot.{$snapshot['snapshotSet']}.{$snapshot['extensionType']}.{$snapshot['extensionName']}", 'Drupal\\config_snapshot\\ConfigSnapshotStorage')
->addArgument($snapshot['snapshotSet'])
->addArgument($snapshot['extensionType'])
->addArgument($snapshot['extensionName']);
}
}