Symfony\Component\DependencyInjection\Definition::setLazy PHP Method

setLazy() public method

Sets the lazy flag of this service.
public setLazy ( boolean $lazy ) : Definition
$lazy boolean
return Definition The current instance
    public function setLazy($lazy)
    {
        $this->lazy = (bool) $lazy;

        return $this;
    }

Usage Example

Example #1
0
 public function testGetProxyFactoryCode()
 {
     $definition = new Definition(__CLASS__);
     $definition->setLazy(true);
     $code = $this->dumper->getProxyFactoryCode($definition, 'foo');
     $this->assertStringMatchesFormat('%wif ($lazyLoad) {%wreturn $this->services[\'foo\'] = new ' . 'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction ' . '(&$wrappedInstance, \\ProxyManager\\Proxy\\LazyLoadingInterface $proxy) {' . '%w$wrappedInstance = $this->getFooService(false);%w$proxy->setProxyInitializer(null);' . '%wreturn true;%w}%w);%w}%w', $code);
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::setLazy