RegisterServicesForDestructionPass::process

public RegisterServicesForDestructionPass::process(ContainerBuilder $container)

You can modify the container here before it is dumped to PHP code.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php, line 19

Class

RegisterServicesForDestructionPass
Adds services tagged "needs_destruction" to the "kernel_destruct_subscriber" service.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  if (!$container->hasDefinition('kernel_destruct_subscriber')) {
    return;
  }

  $definition = $container->getDefinition('kernel_destruct_subscriber');
  $services = $container->findTaggedServiceIds('needs_destruction');
  foreach ($services as $id => $attributes) {
    $definition->addMethodCall('registerService', array($id));
  }
}
doc_Drupal
2016-10-29 09:37:11
Comments
Leave a Comment

Please login to continue.