class LonelyMonkeyController

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php \Drupal\error_service_test\Controller\LonelyMonkeyController

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

Hierarchy

Expanded class hierarchy of LonelyMonkeyController

File

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

Namespace

Drupal\error_service_test\Controller
View source
class LonelyMonkeyController extends ControllerBase implements ContainerInjectionInterface {
  
  /**
   * The lonely monkey class.
   */
  protected $class;
  public function __construct(LonelyMonkeyClass $class) {
    $this->class = $class;
  }
  public function testBrokenClass() {
    return [
      '#markup' => $this->t('This should be broken.'),
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  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.