1
0
mirror of synced 2024-12-13 14:56:01 +03:00

component connection management

This commit is contained in:
zYne 2006-12-05 18:38:04 +00:00
parent dd79e12a28
commit 9aeeffe24e

View File

@ -36,6 +36,10 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @var array $connections an array containing all the opened connections
*/
private $connections = array();
/**
* @var array $bound an array containing all components that have a bound connection
*/
private $bound = array();
/**
* @var integer $index the incremented index
*/
@ -47,7 +51,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
/**
* @var string $root root directory
*/
private $root;
private $root;
/**
* @var Doctrine_Null $null Doctrine_Null object, used for extremely fast null value checking
*/
@ -226,8 +230,20 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @return boolean
*/
public function bindComponent($componentName, $connectionName) {
$this->bound[$componentName] = $connectionName;
}
/**
* getConnectionForComponent
*
* @param string $componentName
* @return Doctrine_Connection
*/
public function getConnectionForComponent($componentName = null) {
if(isset($this->bound[$componentName]))
return $this->getConnection($this->bound[$componentName]);
return $this->getCurrentConnection();
}
/**
* closes the connection
*