set defaultConnection value for both runtime and generator if there is only one connection

This commit is contained in:
Yunan NSNT 2015-12-18 00:08:52 +07:00
parent ead5be068e
commit 8d8cc7be79

View file

@ -36,6 +36,12 @@ class PropelExtension extends Extension
$configuration = $this->getConfiguration($configs, $container);
$config = $processor->processConfiguration($configuration, $configs);
if (1 === count($config['database']['connections'])) {
$defaultConnection = array_keys($config['database']['connections'])[0];
$config['runtime']['defaultConnection'] = $defaultConnection;
$config['generator']['defaultConnection'] = $defaultConnection;
}
$container->setParameter('propel.logging', $config['runtime']['logging']);
$container->setParameter('propel.configuration', $config);