public function CoreBundle::build

Implements \Symfony\Component\HttpKernel\Bundle\BundleInterface::build().

Overrides Bundle::build

File

drupal/core/lib/Drupal/Core/CoreBundle.php, line 43
Definition of Drupal\Core\CoreBundle.

Class

CoreBundle
Bundle class for mandatory core services.

Namespace

Drupal\Core

Code

public function build(ContainerBuilder $container) {

  // The 'request' scope and service enable services to depend on the Request
  // object and get reconstructed when the request object changes (e.g.,
  // during a subrequest).
  $container
    ->addScope(new Scope('request'));
  $this
    ->registerTwig($container);
  $this
    ->registerModuleHandler($container);
  $container
    ->addCompilerPass(new RegisterMatchersPass());
  $container
    ->addCompilerPass(new RegisterRouteFiltersPass());

  // Add a compiler pass for registering event subscribers.
  $container
    ->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
  $container
    ->addCompilerPass(new RegisterAccessChecksPass());

  // Add a compiler pass for upcasting of entity route parameters.
  $container
    ->addCompilerPass(new RegisterParamConvertersPass());
  $container
    ->addCompilerPass(new RegisterRouteEnhancersPass());

  // Add a compiler pass for registering services needing destruction.
  $container
    ->addCompilerPass(new RegisterServicesForDestructionPass());

  // Add the compiler pass that will process the tagged services.
  $container
    ->addCompilerPass(new RegisterPathProcessorsPass());
  $container
    ->addCompilerPass(new ListCacheBinsPass());

  // Add the compiler pass for appending string translators.
  $container
    ->addCompilerPass(new RegisterStringTranslatorsPass());
}