diff --git a/Command/AbstractCommand.php b/Command/AbstractCommand.php index 867d83e..0798c10 100644 --- a/Command/AbstractCommand.php +++ b/Command/AbstractCommand.php @@ -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']); } /** diff --git a/PropelBundle.php b/PropelBundle.php index 5480703..55c5978 100644 --- a/PropelBundle.php +++ b/PropelBundle.php @@ -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'])) {