W3cubDocs

/Drupal 8

public function InstallerServiceProvider::register

public InstallerServiceProvider::register(ContainerBuilder $container)

Registers services to the container.

Parameters

ContainerBuilder $container: The ContainerBuilder to register services to.

Overrides ServiceProviderInterface::register

File

core/lib/Drupal/Core/Installer/InstallerServiceProvider.php, line 22

Class

InstallerServiceProvider
Service provider for the early installer environment.

Namespace

Drupal\Core\Installer

Code

public function register(ContainerBuilder $container) {
  // Inject the special configuration storage for the installer.
  // This special implementation MUST NOT be used anywhere else than the early
  // installer environment.
  $container->register('config.storage', 'Drupal\Core\Config\InstallStorage');

  // Replace services with in-memory implementations.
  $definition = $container->getDefinition('cache_factory');
  $definition->setClass('Drupal\Core\Cache\MemoryBackendFactory');
  $definition->setArguments(array());
  $definition->setMethodCalls(array());
  $container
  ->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory');
  $container
  ->register('keyvalue.expirable', 'Drupal\Core\KeyValueStore\KeyValueNullExpirableFactory');

  // Replace services with no-op implementations.
  $container
  ->register('lock', 'Drupal\Core\Lock\NullLockBackend');
  $container
  ->register('url_generator', 'Drupal\Core\Routing\NullGenerator')
    ->addArgument(new Reference('request_stack'));
  $container
  ->register('path_processor_manager', 'Drupal\Core\PathProcessor\NullPathProcessorManager');
  $container
  ->register('router.dumper', 'Drupal\Core\Routing\NullMatcherDumper');

  // Remove the cache tags invalidator tag from the cache tags storage, so
  // that we don't call it when cache tags are invalidated very early in the
  // installer.
  $container->getDefinition('cache_tags.invalidator.checksum')
    ->clearTag('cache_tags_invalidator');

  // Replace the route builder with an empty implementation.
  // @todo Convert installer steps into routes; add an installer.routing.yml.
  $definition = $container->getDefinition('router.builder');
  $definition->setClass('Drupal\Core\Installer\InstallerRouteBuilder')
    // The core router builder, but there is no reason here to be lazy, so
    // we don't need to ship with a custom proxy class.
    ->setLazy(FALSE);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Installer!InstallerServiceProvider.php/function/InstallerServiceProvider::register/8.1.x