Merge pull request #309 from K-Phoen/infer-default-connection
Fix default connection detection when not explicitly set in the config
This commit is contained in:
commit
1701a4e67d
|
@ -354,7 +354,7 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
|||
{
|
||||
$config = $this->getContainer()->getParameter('propel.configuration');
|
||||
|
||||
return $config['generator']['defaultConnection'];
|
||||
return !empty($config['generator']['defaultConnection']) ? $config['generator']['defaultConnection'] : key($config['database']['connections']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,9 +55,10 @@ class PropelBundle extends Bundle
|
|||
protected function configureConnections()
|
||||
{
|
||||
$config = $this->container->getParameter('propel.configuration');
|
||||
$defaultConnection = !empty($config['runtime']['defaultConnection']) ? $config['runtime']['defaultConnection'] : key($config['database']['connections']);
|
||||
|
||||
$serviceContainer = Propel::getServiceContainer();
|
||||
$serviceContainer->setDefaultDatasource($config['runtime']['defaultConnection']);
|
||||
$serviceContainer->setDefaultDatasource($defaultConnection);
|
||||
|
||||
foreach ($config['database']['connections'] as $name => $config) {
|
||||
if (!empty($config['slaves'])) {
|
||||
|
|
Loading…
Reference in a new issue