View extender: Do not resolve factory

Not all requests need this factory, so there is no need to
instantiate one and load the required files.

Refs #1891, #2134.
This commit is contained in:
Franz Liedke 2020-07-17 12:01:56 +02:00
parent b5e891df30
commit 7e3d71a0a0
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -42,10 +42,10 @@ class ViewNamespace implements ExtenderInterface
public function extend(Container $container, Extension $extension = null)
{
$factory = $container->make(Factory::class);
foreach ($this->adds as $namespace => $hints) {
$factory->addNamespace($namespace, $hints);
}
$container->resolving(Factory::class, function (Factory $view) {
foreach ($this->adds as $namespace => $hints) {
$view->addNamespace($namespace, $hints);
}
});
}
}