Commit 58f78693 authored by chtito's avatar chtito

added the possibility not to set the new connection as current connection

parent 3bcda166
......@@ -173,7 +173,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @throws Doctrine_Manager_Exception if trying to bind a connection with an existing name
* @return Doctrine_Connection
*/
public function openConnection($adapter, $name = null)
public function openConnection($adapter, $name = null, $setCurrent = true)
{
if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) {
throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface");
......@@ -220,8 +220,10 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
default:
throw new Doctrine_Manager_Exception('Unknown connection driver '. $adapter->getAttribute(PDO::ATTR_DRIVER_NAME));
};
$this->currIndex = $name;
if ($setCurrent) {
$this->currIndex = $name;
}
return $this->connections[$name];
}
public function openSession(PDO $pdo, $name = null)
......
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