Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AutowireMethodOf.php

function AutowireMethodOf::__construct

Parameters

string $service The service containing the method to autowire:

bool|class-string $lazy Whether to use lazy-loading for this argument:

Overrides AutowireCallable::__construct

File

vendor/symfony/dependency-injection/Attribute/AutowireMethodOf.php, line 27

Class

AutowireMethodOf
Tells which method should be turned into a Closure based on the name of the parameter it's attached to.

Namespace

Symfony\Component\DependencyInjection\Attribute

Code

public function __construct(string $service, bool|string $lazy = false) {
    parent::__construct([
        new Reference($service),
    ], lazy: $lazy);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal