function ReverseContainer::getId
Same name in this branch
- 11.1.x core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::getId()
Returns the id of the passed object when it exists as a service.
To be reversible, services need to be either public or be tagged with "container.reversible".
File
-
vendor/
symfony/ dependency-injection/ ReverseContainer.php, line 39
Class
- ReverseContainer
- Turns public and "container.reversible" services back to their ids.
Namespace
Symfony\Component\DependencyInjectionCode
public function getId(object $service) : ?string {
if ($this->serviceContainer === $service) {
return 'service_container';
}
if (null === ($id = ($this->getServiceId)($service))) {
return null;
}
if ($this->serviceContainer
->has($id) || $this->reversibleLocator
->has($id)) {
return $id;
}
return null;
}