function ContainerBuilder::register
Same name in other branches
- 9 core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::register()
- 8.9.x core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::register()
- 11.x core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::register()
File
-
core/
lib/ Drupal/ Core/ DependencyInjection/ ContainerBuilder.php, line 53
Class
- ContainerBuilder
- Drupal's dependency injection container builder.
Namespace
Drupal\Core\DependencyInjectionCode
public function register($id, $class = NULL) : Definition {
$definition = new Definition($class);
// As of Symfony 5.2 all services are private by default, but in Drupal
// services are still public by default.
$definition->setPublic(TRUE);
return $this->setDefinition($id, $definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.