1

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?

Charles
  • 50,943
  • 13
  • 104
  • 142
leek
  • 11,803
  • 8
  • 45
  • 61

2 Answers2

1

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.

stunti
  • 855
  • 8
  • 20
-1

I think you can use a database view table to merge data from 2 schemas, and then use Zend Framework to fetch data from that table.

farzad
  • 8,775
  • 6
  • 32
  • 41