Commit 9aeeffe2 authored by zYne's avatar zYne

component connection management

parent dd79e12a
......@@ -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
*/
......@@ -226,7 +230,19 @@ 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
......
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