class RegisterServicesForDestructionPass in Service Container 7.2
Same name and namespace in other branches
- 7 lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass
Adds services tagged "needs_destruction" to the "kernel_destruct_subscriber" service.
Hierarchy
- class \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass implements CompilerPassInterface
Expanded class hierarchy of RegisterServicesForDestructionPass
See also
\Drupal\Core\DestructableInterface
File
- lib/
Drupal/ Core/ DependencyInjection/ Compiler/ RegisterServicesForDestructionPass.php, line 19 - Contains \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass.
Namespace
Drupal\Core\DependencyInjection\CompilerView source
class RegisterServicesForDestructionPass implements CompilerPassInterface {
/**
* Implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process().
*/
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,
));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RegisterServicesForDestructionPass:: |
public | function |
Implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process(). Overrides CompilerPassInterface:: |