1
0
mirror of synced 2024-12-14 15:16:04 +03:00
This commit is contained in:
romanb 2007-12-11 15:46:27 +00:00
parent 532dea0dd2
commit 6a958bae47
2 changed files with 19 additions and 3 deletions

View File

@ -546,6 +546,17 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
return $this->getCurrentConnection(); return $this->getCurrentConnection();
} }
/**
* hasConnectionForComponent
*
* @param string $componentName
* @return boolean
*/
public function hasConnectionForComponent($componentName = null)
{
return isset($this->_bound[$componentName]);
}
/** /**
* getTable * getTable
* this is the same as Doctrine_Connection::getTable() except * this is the same as Doctrine_Connection::getTable() except

View File

@ -1649,8 +1649,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
public function loadRoot($name, $componentAlias) public function loadRoot($name, $componentAlias)
{ {
// get the connection for the component // get the connection for the component
$this->_conn = Doctrine_Manager::getInstance() $manager = Doctrine_Manager::getInstance();
->getConnectionForComponent($name); if ($manager->hasConnectionForComponent($name)) {
$this->_conn = $manager->getConnectionForComponent($name);
}
$table = $this->_conn->getTable($name); $table = $this->_conn->getTable($name);
$tableName = $table->getTableName(); $tableName = $table->getTableName();
@ -1681,7 +1683,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
public function buildInheritanceJoinSql($name, $componentAlias) public function buildInheritanceJoinSql($name, $componentAlias)
{ {
// get the connection for the component // get the connection for the component
$this->_conn = Doctrine_Manager::getInstance()->getConnectionForComponent($name); $manager = Doctrine_Manager::getInstance();
if ($manager->hasConnectionForComponent($name)) {
$this->_conn = $manager->getConnectionForComponent($name);
}
$table = $this->_conn->getTable($name); $table = $this->_conn->getTable($name);
$tableName = $table->getTableName(); $tableName = $table->getTableName();