Symfony2 - doctrine connection configuration in bundle
<p>I have project which uses my additional bundle. This bundle connects to other database and I need configuration for another database.</p>

<p>I want to have this connections in 2 config files.</p>

<p>main config:</p>

<pre><code># 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
</code></pre>

<p>bundle config:</p>

<pre><code># 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
</code></pre>

<p>Bundle Extension file:</p>

<pre><code>class SecondBundleExtension extends Extension
{
    /**
     * {@inheritdoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this-&gt;processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader-&gt;load('config.yml');
    }
}
</code></pre>

<p>In my opinion everything looks OK, but when I'm trying to run this I have communicate:</p>

<blockquote>
  <p>There is no extension able to load the configuration for "doctrine"</p>
</blockquote>