Zend framework zend多表接口
我必须在DPTable接口中添加辅助表。怎么可能呢 例如,关于以下代码:Zend framework zend多表接口,zend-framework,zend-db,Zend Framework,Zend Db,我必须在DPTable接口中添加辅助表。怎么可能呢 例如,关于以下代码: class Application_Model_DbTable_PlanList extends Zend_Db_Table_Abstract { protected $_name = 'hosted_plans'; public function list_plan() { $row = $this->fetchAll(); if (!$row) { throw new
class Application_Model_DbTable_PlanList extends Zend_Db_Table_Abstract
{
protected $_name = 'hosted_plans';
public function list_plan()
{
$row = $this->fetchAll();
if (!$row)
{
throw new Exception("Could not find row $id");
}
return $row->toArray();
}
public function list_plan_features()
{
$table = new HostedPlanContentMapping();
$select = $table->select();
$select->from($table);
$row = $table->fetchAll($select);
if(!$row)
{
throw new Exception("Could not find result");
}
return $row->toArray();
}
}
在上面的代码列表中,使用托管的计划表执行计划功能。我必须在同一个类上添加另一个函数,以从HostedPlanContentMapping获取详细信息。我试着用list_plan_features()来做这件事。并调用控制器,如下所示:
$featurelist = new Application_Model_DbTable_PlanList();
$this->view->listfeature = $featurelist->list_plan_features();
但是没有得到结果
有人能帮我吗?如果愿意,也可以直接从表对象调用DB适配器。如下所示:
$select = $this->getAdapter()->select();
$select->from($tableName);
$row = $this->getAdapter()->fetchAll($select);
希望有帮助