function ServiceIdHashTrait::getServiceIdMappings

Same name in other branches
  1. 10 core/lib/Drupal/Component/DependencyInjection/ServiceIdHashTrait.php \Drupal\Component\DependencyInjection\ServiceIdHashTrait::getServiceIdMappings()
  2. 11.x core/lib/Drupal/Component/DependencyInjection/ServiceIdHashTrait.php \Drupal\Component\DependencyInjection\ServiceIdHashTrait::getServiceIdMappings()

Implements \Drupal\Component\DependencyInjection\ContainerInterface::getServiceIdMappings()

File

core/lib/Drupal/Component/DependencyInjection/ServiceIdHashTrait.php, line 18

Class

ServiceIdHashTrait
A trait for service id hashing implementations.

Namespace

Drupal\Component\DependencyInjection

Code

public function getServiceIdMappings() : array {
    @trigger_error(__METHOD__ . "() is deprecated in drupal:9.5.1 and is removed from drupal:11.0.0. Use the 'Drupal\\Component\\DependencyInjection\\ReverseContainer' service instead. See https://www.drupal.org/node/3327942", E_USER_DEPRECATED);
    $mapping = [];
    foreach ($this->getServiceIds() as $service_id) {
        if ($this->initialized($service_id) && $service_id !== 'service_container') {
            $service = $this->get($service_id);
            if (is_object($service)) {
                $mapping[$this->generateServiceIdHash($service)] = $service_id;
            }
        }
    }
    return $mapping;
}

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