I have project which uses my additional bundle. This bundle connects to other database and I need configuration for another database.
I want to have this connections in 2 config files.
main config:
# ROOT/app/config/config.yml:
doctrine:
dbal:
default_connection: default
connections:
default:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
bundle config:
# src/SecondBundle/Resources/config/config.yml
doctrine:
dbal:
connections:
secondBundle:
driver: "%secondBundle.database_driver%"
host: "%secondBundle.database_host%"
port: "%secondBundle.database_port%"
dbname: "%secondBundle.database_name%"
user: "%secondBundle.database_user%"
password: "%secondBundle.database_password%"
charset: UTF8
Bundle Extension file:
class SecondBundleExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('config.yml');
}
}
In my opinion everything looks OK, but when I'm trying to run this I have communicate:
There is no extension able to load the configuration for "doctrine"