function ClassResolverInterface::getInstanceFromDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php \Drupal\Core\DependencyInjection\ClassResolverInterface::getInstanceFromDefinition()
  2. 8.9.x core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php \Drupal\Core\DependencyInjection\ClassResolverInterface::getInstanceFromDefinition()
  3. 10 core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php \Drupal\Core\DependencyInjection\ClassResolverInterface::getInstanceFromDefinition()

Returns a class instance with a given class definition.

In contrast to controllers you don't specify a method.

Parameters

string $definition: A class name or service name.

Return value

object The instance of the class.

Throws

\InvalidArgumentException If $class is not a valid service identifier and the class does not exist.

1 method overrides ClassResolverInterface::getInstanceFromDefinition()
ClassResolver::getInstanceFromDefinition in core/lib/Drupal/Core/DependencyInjection/ClassResolver.php

File

core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php, line 24

Class

ClassResolverInterface
Provides interface to get an instance of a class with dependency injection.

Namespace

Drupal\Core\DependencyInjection

Code

public function getInstanceFromDefinition($definition);

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