I have to add secondary table inside on DPTable interface. How is it possible?
for example on the following code :
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();
}
}
IN above code list_plan function using hosted_plans table. I have to add another function on this same class to fetch details from HostedPlanContentMapping. which I tried to do with list_plan_features(). and calling on controller like below:
$featurelist = new Application_Model_DbTable_PlanList();
$this->view->listfeature = $featurelist->list_plan_features();
But not getting result.
Can anybody help me on this?
As an alternative, you can always call the DB adapter directly from the Table object, if you wish. Something like the following:
$select = $this->getAdapter()->select();
$select->from($tableName);
$row = $this->getAdapter()->fetchAll($select);
Hope that helps,