Closed
Description
For context: #42450
Basically DI extensions and the kernel use a separeate file loader instance.
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
should look familiar to many of us :) constructing the new PhpFileLoader is more painful.
However, the kernel, uses a powerful delegating one:
symfony/src/Symfony/Component/HttpKernel/Kernel.php
Lines 757 to 772 in 76a414c
What about leveraging it in extensions? Could we? Eg. receive it as argument, $loader->load(__DIR__.'/../Resources/config/services.xml');
, and done :)
Maybe a ScopedLoader to provide a basepath for decoration? Or out-of-the-box bundle paths like @My/Resources/config/services.xml
. But i actually tend to prefer explicit absolute paths (local PHP vars/runtime FTW).
WDYT?