Last Updated: May 23, 2016
·
1.028K
· pandrieux

Symfony configuration prepend

As described here, symfony provides a way to inject configuration from bundle B to bundle A.

This is amazing but when the bundle B configuration is based on a parameter (like %foo.bar%), the value injected will be the parameter path but not the value.
To transform parameter path into the value, you have to call:
$config = $container->getExtensionConfig($this->getAlias()); $config = $container->getParameterBag()->resolveValue($config); $config = $this->processConfiguration(new Configuration(), $config);
instead of
$config = $container->getExtensionConfig($this->getAlias()); $config = $this->processConfiguration(new Configuration(), $config);

The resolveValue method will fetch the parameters and get each values

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside