added the possibility not to set the new connection as current connection
This commit is contained in:
parent
3bcda166d2
commit
58f78693a0
@ -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");
|
||||||
@ -220,8 +220,10 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
|
|||||||
default:
|
default:
|
||||||
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));
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->currIndex = $name;
|
if ($setCurrent) {
|
||||||
|
$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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user