G
G
grabbee2020-04-24 18:15:34
symfony
grabbee, 2020-04-24 18:15:34

How to transfer the configuration from the config of one bundle to another?

So far, I can’t figure out how to transfer the configuration from the config of one bundle to another. Mutually exclusive problems appear through Bundle Extension or PrependExtensionInterface

  • public function load(array $configs, ContainerBuilder $container) - has my bundle config, but empty container. No access to configs of other bundles
  • public function prepend(ContainerBuilder $container) - has a relatively full container, but at this point the bundle configs have not been touched yet. Here you can make changes to other bundles, but here you can not get the configuration of my bundle


I would like to create a config file of my bundle at the time of application configuration in packages . Write the parameter there. And in the bundle itself, transfer this parameter to the configuration of another bundle. As if I had directly specified it when configuring directly.

Application - config Bundle1 - parameter.X
Bundle1 get parameter.X and write parameter.Y to
Bundle2 Bundle2 config has parameter.Y

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grabbee, 2020-04-24
@grabbee

In public function prepend(ContainerBuilder $container) - $container is available - you need to get configs from it $configs = $container->getExtensionConfig($this->getAlias()); and process via $config = $this->processConfiguration(new Configuration(), $configs); Take any values ​​from there and put them anywhere (description in the dock $container->prependExtensionConfig('liip_imagine', $liip_config)).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question