check whether the value of defaultConnection have been set or not

This commit is contained in:
Yunan NSNT 2015-12-18 10:16:07 +07:00
parent 8d8cc7be79
commit 301df4331c

View file

@ -38,9 +38,13 @@ class PropelExtension extends Extension
if (1 === count($config['database']['connections'])) { if (1 === count($config['database']['connections'])) {
$defaultConnection = array_keys($config['database']['connections'])[0]; $defaultConnection = array_keys($config['database']['connections'])[0];
if (!isset($config['runtime']['defaultConnection'])) {
$config['runtime']['defaultConnection'] = $defaultConnection; $config['runtime']['defaultConnection'] = $defaultConnection;
}
if (!isset($config['generator']['defaultConnection'])) {
$config['generator']['defaultConnection'] = $defaultConnection; $config['generator']['defaultConnection'] = $defaultConnection;
} }
}
$container->setParameter('propel.logging', $config['runtime']['logging']); $container->setParameter('propel.logging', $config['runtime']['logging']);
$container->setParameter('propel.configuration', $config); $container->setParameter('propel.configuration', $config);