I have a few tables that I’ve defined like the below examples:
class TableA extends Zend_Db_Table_Abstract { protected $_schema = 'schema1'; protected $_name = 'tablea'; } class TableB extends Zend_Db_Table_Abstract { protected $_schema = 'schema2'; protected $_name = 'tableb'; }
This seems to work perfectly using one default Db adapter (since the 2 schemas are on the same server).
Code like this works:
$tableA = new TableA(); $select = $tableA->select(); // $select->__toString() outputs: SELECT * FROM `schema1`.`tablea`
However, when I try to use the same models with any of the Zend Framework table relationship functions (ie: findDependantRowset() or findManyToManyRowset()) the query tries to execute using the schema from the default adapter and does not use the appropriate schema that is defined in the model class.
Is this a bug? How can I force ZF to use the schema I have defined in the table class and not the one defined as the default in the default Db adapter?
I think this is related to this bug: http://framework.zend.com/issues/browse/ZF-1838
It has been fixed in the upstream and should be available in the next release.