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

Breadcrumb

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

trait LazyTrait

Hierarchy

  • trait \Symfony\Component\DependencyInjection\Loader\Configurator\Traits\LazyTrait

File

vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php, line 14

Namespace

Symfony\Component\DependencyInjection\Loader\Configurator\Traits
View source
trait LazyTrait {
    
    /**
     * Sets the lazy flag of this service.
     *
     * @param bool|string $lazy A FQCN to derivate the lazy proxy from or `true` to make it extend from the definition's class
     *
     * @return $this
     */
    public final function lazy(bool|string $lazy = true) : static {
        $this->definition
            ->setLazy((bool) $lazy);
        if (\is_string($lazy)) {
            $this->definition
                ->addTag('proxy', [
                'interface' => $lazy,
            ]);
        }
        return $this;
    }

}

Members

Title Sort descending Modifiers Object type Summary
LazyTrait::lazy final public function Sets the lazy flag of this service.
RSS feed
Powered by Drupal