0
votes

I have generated new bundle: RusabTestBundle. It has among other things files:

- DependencyInjection
--  RusabTestBundleExtension.php
--  Configuration.php

In RusabTestBundleExtension.php I have:

$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');

In Configuration.php I have:

$rootNode = $treeBuilder->root('rusab_test_service');

Next:

- Resources
-- services.yml

In services.yml I paste:

rusab_test_service:

And I have error:

There is no extension able to load the configuration for "rusab_test_service" (in /xxx/src/Rusab/TestBundle/DependencyInjection/../Resources/config/services.yml). Looked for namespace "rusab_test_service", found none

But I i paste

rusab_test_service:

to

app/config/config.yml

then this is working ok.

Why? I know, I can import services.yml in app/config/config.yml, but for what is loader in RusabTestBundleExtension.php?

1
Try this: stackoverflow.com/a/35505189 and naming the key in the yml & Configuration.php files rusab_testAlister Bulman
@AlisterBulman it also isn't working for merusab
Basically, the tree builder is used to create a bundles default configuration. There is no Bundle/resources/config.yml file. And then of course app/config can be used to override specific nodes.Cerad

1 Answers

0
votes

The way bundle configuration works is by building a configuration tree of all the various options.

You are trying to build the tree by loading in a config file which might be nice but it's not the way Symfony is designed.

So build your tree in Configuration.php and then give the application the ability to override specific values via app/config/config.yml