Answer the question
In order to leave comments, you need to log in
How to properly configure a third-party bundle in your own?
For example , LiipImagineBundle - it has many parameters that need to be set in its own config.
I want to make a separate bundle in which almost everything should be already configured.
How to do it right?
1. Import the config file from your bundle into the application.
2. $container->prependExtensionConfig($name, $config);
Or how is it in general?
Answer the question
In order to leave comments, you need to log in
Redefining configuration in Symfony outside of the main process of loading configuration files is not the easiest thing to do. This process is closed from direct customization. the main process of loading and processing the bundles configuration is completely at the mercy of them. The reason for these restrictions is that loading the configuration is one of the earliest stages of work and, as with all such parts of the code, there is quite a bit of room for maneuver. In this regard, the way (and the very possibility) of redefining the configuration will very much depend on what exactly you want to redefine.
In order to better understand how this happens, you should study in more detail the question of how the loading and processing of the configuration in Symfony is organized.
In short:
LiipImagineBundle
). LiipImagineBundle
in the whole case, nothing terrible happens, the resulting configuration is immediately sent to processing and then used to register services and parameters. ContainerBuilder
before other extensions are loaded, which is what will allow you to use ContainerBuilder::loadFromExtension() to add configuration options to the bundle you need. Yes. It seems to work.
# implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/packages'));
$loader->load('liip_imagine.yaml');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question