Commit a6dde11a authored by Fabien Potencier's avatar Fabien Potencier

merged branch igorw/doctrine-lazy-conn (PR #722)

This PR was squashed before being merged into the 1.0 branch (closes #722).

Discussion
----------

Make DoctrineServiceProvider db connection lazy

Specifically, do not create all connections early, only create them as
needed.

Commits
-------

9cf31e47 Make DoctrineServiceProvider db connection lazy
parents 3dd45688 9cf31e47
...@@ -4,7 +4,7 @@ Changelog ...@@ -4,7 +4,7 @@ Changelog
1.0.1 (2013-XX-XX) 1.0.1 (2013-XX-XX)
------------------ ------------------
* n/a * Make ``DoctrineServiceProvider`` multi-db support lazy.
1.0.0 (2013-05-03) 1.0.0 (2013-05-03)
------------------ ------------------
......
...@@ -74,7 +74,9 @@ class DoctrineServiceProvider implements ServiceProviderInterface ...@@ -74,7 +74,9 @@ class DoctrineServiceProvider implements ServiceProviderInterface
$manager = $app['dbs.event_manager'][$name]; $manager = $app['dbs.event_manager'][$name];
} }
$dbs[$name] = DriverManager::getConnection($options, $config, $manager); $dbs[$name] = $dbs->share(function ($dbs) use ($options, $config, $manager) {
return DriverManager::getConnection($options, $config, $manager);
});
} }
return $dbs; return $dbs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment