尝试了解使用Zend_Db_Table
。
然后我创建了类:
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');
}
然后我想:
$table_1 = new table_1();
$data = $table_1->fetchAll();
包含所有依赖表。 有没有办法做到这一点?
答案 0 :(得分:0)
查看Zend_Db_Table
和Zend_Db_Table_Select
的代码表明这是不可能的。它始终只在单个表上运行fetchAll
。