function Container::getServiceAlternatives

Same name in other branches
  1. 9 core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container::getServiceAlternatives()
  2. 8.9.x core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container::getServiceAlternatives()
  3. 11.x core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container::getServiceAlternatives()

Provides alternatives in case a service was not found.

Parameters

string $id: The service to get alternatives for.

Return value

string[] An array of strings with suitable alternatives.

1 call to Container::getServiceAlternatives()
Container::get in core/lib/Drupal/Component/DependencyInjection/Container.php

File

core/lib/Drupal/Component/DependencyInjection/Container.php, line 530

Class

Container
Provides a container optimized for Drupal's needs.

Namespace

Drupal\Component\DependencyInjection

Code

protected function getServiceAlternatives($id) {
    $all_service_keys = array_unique(array_merge(array_keys($this->services), array_keys($this->serviceDefinitions)));
    return $this->getAlternatives($id, $all_service_keys);
}

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