If I was to redefine the db connection as below, would that leave the original connection open or close it ? I am trying to switch between databases, the host could also change ie. master/slave
DI::getDefault()->set('db', function ()
use ($db_host, $db_username, $db_password,$db_name)
{
$connection["host"] = $db_host;
$connection["username"] = $db_username;
$connection["password"] = $db_password;
$connection["dbname"] = $db_name;
return new DbAdapter($connection);
});
DI::getDefault()->set('db', function ()
use ($db_host, $db_username, $db_password,$db_name2)
{
$connection["host"] = $db_host;
$connection["username"] = $db_username;
$connection["password"] = $db_password;
$connection["dbname"] = $db_name2;
return new DbAdapter($connection);
});