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