public function 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));
  }
}

© 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!DependencyInjection!Compiler!RegisterServicesForDestructionPass.php/function/RegisterServicesForDestructionPass::process/8.1.x