public function ProxyDumper::getProxyCode in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/ProxyBuilder/ProxyDumper.php \Drupal\Component\ProxyBuilder\ProxyDumper::getProxyCode()
Generates the code for the lazy proxy.
Parameters
Definition $definition:
Return value
string
Overrides DumperInterface::getProxyCode
File
- lib/
Drupal/ Component/ ProxyBuilder/ ProxyDumper.php, line 65 - Contains \Drupal\Component\ProxyBuilder\ProxyDumper.
Class
- ProxyDumper
- Dumps the proxy service into the dumped PHP container file.
Namespace
Drupal\Component\ProxyBuilderCode
public function getProxyCode(Definition $definition) {
// Maybe the same class is used in different services, which are both marked
// as lazy (just think about 2 database connections).
// In those cases we should not generate proxy code the second time.
if (!isset($this->buildClasses[$definition
->getClass()])) {
$this->buildClasses[$definition
->getClass()] = TRUE;
return $this->builder
->build($definition
->getClass());
}
else {
return '';
}
}