2

trying to understand of using Zend_Db_Table.

i have a such table:

then i created classes:

class table_1 extends Zend_Db_Table_Abstract
{
    protected $_name = 'table_1';
    protected $_primary = 't1_id';
    protected $_referenceMap    = array(
        'DepCard' => array(
            'columns'           => 't1_id',
            'refTableClass'     => 'table_2',
            'refColumns'        => 't2_t1'
        ),
        'Select1' => array(
            'columns' => array('t1_select1'),
            'refTableClass' => 'Select_1'
        ),
        'Select2' => array(
            'columns' => array('t1_select2'),
            'refTableClass' => 'Select_2'
        )
    );

}

class table_2 extends Zend_Db_Table_Abstract {
  protected $_dependentTables = array('table_1');
}
class Select_1 extends Zend_Db_Table_Abstract {
  protected $_dependentTables = array('table_1');
}
class Select_2 extends Zend_Db_Table_Abstract{
  protected $_dependentTables = array('table_1');
}

then i want to:

$table_1 = new table_1();
$data = $table_1->fetchAll();

with all dependent tables. is there any way to do this?

Subdigger
  • 2,166
  • 3
  • 20
  • 42

1 Answers1

0

Looking at Zend_Db_Table's and Zend_Db_Table_Select's code indicates that this is not possible. It always runs fetchAll on the single table only.

cweiske
  • 30,033
  • 14
  • 133
  • 194
  • so, only way is to make `class my_table_abstract extends Zend_Db_Table_Abstract` and overload base functionality ? may be there simple way? – Subdigger Aug 03 '11 at 14:20