function LonelyMonkeyController::create

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php \Drupal\error_service_test\Controller\LonelyMonkeyController::create()
  2. 8.9.x core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php \Drupal\error_service_test\Controller\LonelyMonkeyController::create()
  3. 11.x core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php \Drupal\error_service_test\Controller\LonelyMonkeyController::create()

Instantiates a new instance of the implementing class using autowiring.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Return value

static

Overrides AutowireTrait::create

File

core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php, line 33

Class

LonelyMonkeyController
Provides a controller which calls out to a service with missing dependencies.

Namespace

Drupal\error_service_test\Controller

Code

public static function create(ContainerInterface $container) {
    return new static($container->get('broken_class_with_missing_dependency'));
}

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