RegisterServicesForDestructionPass.php
Same filename and directory in other branches
- 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php
- 10 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php
- 9 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php
- 8.9.x core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php
Namespace
Drupal\Core\DependencyInjection\CompilerFile
-
core/
lib/ Drupal/ Core/ DependencyInjection/ Compiler/ RegisterServicesForDestructionPass.php
View source
<?php
namespace Drupal\Core\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Adds services to the "kernel.destructable_services" container parameter.
*
* Only services tagged with "needs_destruction" are added.
*
* @see \Drupal\Core\DestructableInterface
*/
class RegisterServicesForDestructionPass implements CompilerPassInterface {
use PriorityTaggedServiceTrait;
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container) : void {
$service_ids = array_values(array_map(strval(...), $this->findAndSortTaggedServices('needs_destruction', $container)));
$container->setParameter('kernel.destructable_services', $service_ids);
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| RegisterServicesForDestructionPass | Adds services to the "kernel.destructable_services" container parameter. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.