Commit 6a958bae authored by romanb's avatar romanb

Fixed #665.

parent 532dea0d
......@@ -546,6 +546,17 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
return $this->getCurrentConnection();
}
/**
* hasConnectionForComponent
*
* @param string $componentName
* @return boolean
*/
public function hasConnectionForComponent($componentName = null)
{
return isset($this->_bound[$componentName]);
}
/**
* getTable
* this is the same as Doctrine_Connection::getTable() except
......
......@@ -1649,8 +1649,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
public function loadRoot($name, $componentAlias)
{
// 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);
$tableName = $table->getTableName();
......@@ -1681,7 +1683,10 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
public function buildInheritanceJoinSql($name, $componentAlias)
{
// 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);
$tableName = $table->getTableName();
......
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