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

Breadcrumb

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

class AutowireMethodOf

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

Hierarchy

  • class \Symfony\Component\DependencyInjection\Attribute\Autowire
    • class \Symfony\Component\DependencyInjection\Attribute\AutowireInline extends \Symfony\Component\DependencyInjection\Attribute\Autowire
      • class \Symfony\Component\DependencyInjection\Attribute\AutowireCallable extends \Symfony\Component\DependencyInjection\Attribute\AutowireInline
        • class \Symfony\Component\DependencyInjection\Attribute\AutowireMethodOf extends \Symfony\Component\DependencyInjection\Attribute\AutowireCallable

Expanded class hierarchy of AutowireMethodOf

File

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

Namespace

Symfony\Component\DependencyInjection\Attribute
View source
class AutowireMethodOf extends AutowireCallable {
    
    /**
     * @param string            $service The service containing the method to autowire
     * @param bool|class-string $lazy    Whether to use lazy-loading for this argument
     */
    public function __construct(string $service, bool|string $lazy = false) {
        parent::__construct([
            new Reference($service),
        ], lazy: $lazy);
    }
    public function buildDefinition(mixed $value, ?string $type, \ReflectionParameter $parameter) : Definition {
        $value[1] = $parameter->name;
        return parent::buildDefinition($value, $type, $parameter);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Autowire::$lazy public property
Autowire::$value public property
AutowireMethodOf::buildDefinition public function Overrides AutowireCallable::buildDefinition
AutowireMethodOf::__construct public function Overrides AutowireCallable::__construct

API Navigation

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