protected function dbalLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('dbal.xml');

        if (empty($config['default_connection'])) {
            $keys                         = array_keys($config['connections']);
            $config['default_connection'] = reset($keys);
        }

        $this->defaultConnection = $config['default_connection'];

        $container->setAlias('database_connection', sprintf('doctrine.dbal.%s_connection', $this->defaultConnection));
        $container->getAlias('database_connection')->setPublic(true);
        $container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $this->defaultConnection), false));

        $container->setParameter('doctrine.dbal.connection_factory.types', $config['types']);

        $connections = [];

        foreach (array_keys($config['connections']) as $name) {
            $connections[$name] = sprintf('doctrine.dbal.%s_connection', $name);
        }

        $container->setParameter('doctrine.connections', $connections);
        $container->setParameter('doctrine.default_connection', $this->defaultConnection);

        foreach ($config['connections'] as $name => $connection) {
            $this->loadDbalConnection($name, $connection, $container);
        }
    }
protected function dbalLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('dbal.xml');

        if (empty($config['default_connection'])) {
            $keys                         = array_keys($config['connections']);
            $config['default_connection'] = reset($keys);
        }

        $this->defaultConnection = $config['default_connection'];

        $container->setAlias('database_connection', sprintf('doctrine.dbal.%s_connection', $this->defaultConnection));
        $container->getAlias('database_connection')->setPublic(true);
        $container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $this->defaultConnection), false));

        $container->setParameter('doctrine.dbal.connection_factory.types', $config['types']);

        $connections = [];

        foreach (array_keys($config['connections']) as $name) {
            $connections[$name] = sprintf('doctrine.dbal.%s_connection', $name);
        }

        $container->setParameter('doctrine.connections', $connections);
        $container->setParameter('doctrine.default_connection', $this->defaultConnection);

        foreach ($config['connections'] as $name => $connection) {
            $this->loadDbalConnection($name, $connection, $container);
        }
    }
protected function dbalLoad ( array $ config , ContainerBuilder $ container ) { $ loader = new XmlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'dbal.xml' ) ; if ( empty ( $ config [ 'default_connection' ] ) ) { $ keys = array_keys ( $ config [ 'connections' ] ) ; $ config [ 'default_connection' ] = reset ( $ keys ) ; } $ this -> defaultConnection = $ config [ 'default_connection' ] ; $ container -> setAlias ( 'database_connection' , sprintf ( 'doctrine.dbal.%s_connection' , $ this -> defaultConnection ) ) ; $ container -> getAlias ( 'database_connection' ) -> setPublic ( true ) ; $ container -> setAlias ( 'doctrine.dbal.event_manager' , new Alias ( sprintf ( 'doctrine.dbal.%s_connection.event_manager' , $ this -> defaultConnection ) , false ) ) ; $ container -> setParameter ( 'doctrine.dbal.connection_factory.types' , $ config [ 'types' ] ) ; $ connections = [ ] ; foreach ( array_keys ( $ config [ 'connections' ] ) as $ name ) { $ connections [ $ name ] = sprintf ( 'doctrine.dbal.%s_connection' , $ name ) ; } $ container -> setParameter ( 'doctrine.connections' , $ connections ) ; $ container -> setParameter ( 'doctrine.default_connection' , $ this -> defaultConnection ) ; foreach ( $ config [ 'connections' ] as $ name => $ connection ) { $ this -> loadDbalConnection ( $ name , $ connection , $ container ) ; } }
Loads the DBAL configuration.

Usage example:

<doctrine:dbal id="myconn" dbname="sfweb" user="root" />

@param array            $config    An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance
Loads the DBAL configuration .