I had similar needs, and I solved them as follows:
1) Extend the parent configuration class
//FooBundle\DependencyInjection\Configuration.php use DerpBundle\DependencyInjection\Configuration as BaseConfiguration; class Configuration extends BaseConfiguration { public function getConfigTreeBuilder() { $treeBuilder = parent::getConfigTreeBuilder(); //protected attribute access workaround $reflectedClass = new \ReflectionObject($treeBuilder); $property = $reflectedClass->getProperty("root"); $property->setAccessible(true); $rootNode = $property->getValue($treeBuilder); $rootNode ->children() ... return $treeBuilder; } }
2) Create your own extension that can really handle new configuration entries
class FooExtension extends Extension { public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs);
3) in app\config\config.yml
, which you can use in your new foo
attribute - set all the parameters that derp
(as a parent set) has, plus any of your new parameters that you defined in Configuration.php
.
source share