public function ContainerBuilder::setDefinition in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::setDefinition()
File
- core/
lib/ Drupal/ Core/ DependencyInjection/ ContainerBuilder.php, line 107
Class
- ContainerBuilder
- Drupal's dependency injection container builder.
Namespace
Drupal\Core\DependencyInjectionCode
public function setDefinition($id, Definition $definition) {
$definition = parent::setDefinition($id, $definition);
// As of Symfony 3.4 all definitions are private by default.
// \Symfony\Component\DependencyInjection\Compiler\ResolvePrivatesPassOnly
// removes services marked as private from the container even if they are
// also marked as public. Drupal requires services that are public to
// remain in the container and not be removed.
if ($definition
->isPublic()) {
$definition
->setPrivate(FALSE);
}
return $definition;
}