1
0
mirror of synced 2025-01-18 22:41:43 +03:00

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

This commit is contained in:
chtito 2007-01-19 17:00:25 +00:00
parent 3bcda166d2
commit 58f78693a0

View File

@ -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)