function ProxyBuilder::buildLazyLoadItselfMethod
Same name in other branches
- 9 core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildLazyLoadItselfMethod()
- 8.9.x core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildLazyLoadItselfMethod()
- 11.x core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildLazyLoadItselfMethod()
Generates the string for the method which loads the actual service.
Return value
string
1 call to ProxyBuilder::buildLazyLoadItselfMethod()
- ProxyBuilder::build in core/
lib/ Drupal/ Component/ ProxyBuilder/ ProxyBuilder.php - Builds a proxy class string.
File
-
core/
lib/ Drupal/ Component/ ProxyBuilder/ ProxyBuilder.php, line 171
Class
- ProxyBuilder
- Generates the string representation of the proxy service.
Namespace
Drupal\Component\ProxyBuilderCode
protected function buildLazyLoadItselfMethod() {
$output = <<<'EOS'
/**
* Lazy loads the real service from the container.
*
* @return object
* Returns the constructed real service.
*/
protected function lazyLoadItself()
{
if (!isset($this->service)) {
$this->service = $this->container->get($this->drupalProxyOriginalServiceId);
}
return $this->service;
}
EOS;
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.