You are here

public function ContainerBuilder::findDefinition in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::findDefinition()

Gets a service definition by id or alias.

The method "unaliases" recursively to return a Definition instance.

@api

Parameters

string $id The service identifier or alias:

Return value

Definition A Definition instance

Throws

InvalidArgumentException if the service definition does not exist

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 887

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function findDefinition($id) {
  $id = strtolower($id);
  while (isset($this->aliasDefinitions[$id])) {
    $id = (string) $this->aliasDefinitions[$id];
  }
  return $this
    ->getDefinition($id);
}