Details
Description
When multiples connections are defined, sometimes the Search behavior use a wrong one.
This happens because the Query::loadRoot() method calls the Manager::getConnectionForComponent(), which returns the bound connection for the root component (like ModelIndex in this case), but the connection for this component is never bound.
The following and attached patch solved the issue for me.
Search / connection patch
Index: lib/Doctrine/Search.php
===================================================================
--- lib/Doctrine/Search.php (révision 7080)
+++ lib/Doctrine/Search.php (copie de travail)
@@ -76,7 +76,9 @@
$result = parent::buildTable();
if ( ! isset($this->_options['connection'])) {
- $this->_options['connection'] = $this->_options['table']->getConnection();
+ $manager = Doctrine_Manager::getInstance();
+ $this->_options['connection'] = $manager->getConnectionForComponent($this->_options['table']->getComponentName());
+ $manager->bindComponent($this->_options['className'], $this->_options['connection']->getName());
}
return $result;
Note : we can't use directly
$this->_options['connection'] = $this->_options['table']->getConnection();
because I sometimes found the getConnection() returns the wrong connection (I didn't looked why).
Can you test this against the latest 1.2 SVN? I applied a fix to Generator.php that might help this issue.