Gets a service.
@api
Parameters
string $id The service identifier:
int $invalidBehavior The behavior when the service does not exist:
Return value
object The associated service
Throws
InvalidArgumentException if the service is not defined
See also
Reference
File
- drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php, line 57
Class
- ContainerInterface
- ContainerInterface is the interface implemented by service container classes.
Namespace
Symfony\Component\DependencyInjection
Code
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);