Commit dd79e12a authored by zYne's avatar zYne

removed datasource handling as lazy connecting is now being done by Doctrine_Db automatically

parent e2b585dc
...@@ -36,10 +36,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera ...@@ -36,10 +36,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @var array $connections an array containing all the opened connections * @var array $connections an array containing all the opened connections
*/ */
private $connections = array(); private $connections = array();
/**
* @var array $dataSourceNames an array containing all available data source names
*/
private $dataSourceNames = array();
/** /**
* @var integer $index the incremented index * @var integer $index the incremented index
*/ */
...@@ -213,26 +209,24 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera ...@@ -213,26 +209,24 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @throws Doctrine_Manager_Exception if trying to get a non-existent connection * @throws Doctrine_Manager_Exception if trying to get a non-existent connection
*/ */
public function getConnection($name) { public function getConnection($name) {
if (!isset($this->connections[$name])) { if( ! isset($this->connections[$name]))
if (isset($this->dataSourceNames[$name])) { throw new Doctrine_Manager_Exception('Unknown connection: ' . $name);
$conn = Doctrine_Db::getConnection($this->dataSourceNames[$name]); // Establishes the connection
$this->openConnection($conn, $name);
} else {
throw new Doctrine_Manager_Exception("Unknown connection: $name");
}
}
$this->currIndex = $name; $this->currIndex = $name;
return $this->connections[$name]; return $this->connections[$name];
} }
/** /**
* Adds the dsn of a connection to the list of available data source names. * bindComponent
* binds given component to given connection
* this means that when ever the given component uses a connection
* it will be using the bound connection instead of the current connection
* *
* @param string $dsn * @param string $componentName
* @param string $name * @param string $connectionName
* @return boolean
*/ */
public function addDSN($dsn, $name) { public function bindComponent($componentName, $connectionName) {
$this->dataSourceNames[$name] = $dsn;
} }
/** /**
* closes the connection * 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