class RegisterServicesForDestructionPass

Same name in other branches
  1. 9 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass
  2. 8.9.x core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass
  3. 10 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterServicesForDestructionPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass

Adds services to the "kernel.destructable_services" container parameter.

Only services tagged with "needs_destruction" are added.

Hierarchy

  • class \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface uses \Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait

Expanded class hierarchy of RegisterServicesForDestructionPass

See also

\Drupal\Core\DestructableInterface

1 file declares its use of RegisterServicesForDestructionPass
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php

File

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

Namespace

Drupal\Core\DependencyInjection\Compiler
View source
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);
    }

}

Members

Title Sort descending Modifiers Object type Summary
RegisterServicesForDestructionPass::process public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.