[DI] fix dumping lazy non-shared services
This commit is contained in:
parent
1382001dfe
commit
a4f4ca74a7
@ -886,6 +886,7 @@ EOF;
|
|||||||
if ($asFile) {
|
if ($asFile) {
|
||||||
$code = str_replace('$this', '$container', $code);
|
$code = str_replace('$this', '$container', $code);
|
||||||
$code = str_replace('function () {', 'function () use ($container) {', $code);
|
$code = str_replace('function () {', 'function () use ($container) {', $code);
|
||||||
|
$code = str_replace('function ($lazyLoad = true) {', 'function ($lazyLoad = true) use ($container) {', $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
$code .= " }\n";
|
$code .= " }\n";
|
||||||
|
@ -30,7 +30,7 @@ class getNonSharedFooService extends ProjectServiceContainer
|
|||||||
{
|
{
|
||||||
include_once $container->targetDir.''.'/Fixtures/includes/foo_lazy.php';
|
include_once $container->targetDir.''.'/Fixtures/includes/foo_lazy.php';
|
||||||
|
|
||||||
$container->factories['non_shared_foo'] = function ($lazyLoad = true) {
|
$container->factories['non_shared_foo'] = function ($lazyLoad = true) use ($container) {
|
||||||
return new \Bar\FooLazyClass();
|
return new \Bar\FooLazyClass();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user