Description
Description
Given: A Bundle extension with an implemented PrependExtensionInterface
public function prepend(ContainerBuilder $container): void
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
if ($specialConditionTriggers) {
$loader->load('my_config_and_services.yaml');
}
}
The Problem: The Loader (in this example, I'm using the YAML file loader) calls loadFromExtension
, and so the configuration part gets appended:
symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
Lines 952 to 954 in d04ef91
Adding a new argument to the loader methods load()
is probably not the best solution regarding BC, but maybe we could add a second load method? For example:
public function prependLoad(mixed $resource, string $type = null) {}
For now, I need to split up those configuration / service files, then I also have to parse the configuration manually to finally use prependExtensionConfig
in my extension. This feels a bit odd because there is a service that could actually do it for me. :)
Example
No response