public function DependencySerializationTraitPass::process

public DependencySerializationTraitPass::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/DependencySerializationTraitPass.php, line 18

Class

DependencySerializationTraitPass
Sets the _serviceId property on all services.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  foreach ($container->getDefinitions() as $service_id => $definition) {
    // Only add the property to services that are public (as private services
    // can not be reloaded through Container::get()) and are objects.
    if (!$definition->hasTag('parameter_service') && $definition->isPublic()) {
      $definition->setProperty('_serviceId', $service_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!DependencySerializationTraitPass.php/function/DependencySerializationTraitPass::process/8.1.x