Ben bu iki model var:
class Application_Model_List extends Zend_Db_Table_Abstract
{
protected $_name = 'list';
protected $_primary = 'list_id';
protected $_dependentTables = array('Application_Model_Task');
public function getUserLists($user)
{
$select = $this->select()->from($this->_name)->where('list_user = ?',$user);
return $this->fetchAll($select);
}
}
ve
class Application_Model_Task extends Zend_Db_Table_Abstract
{
protected $_name = 'task';
protected $_primary = 'task_id';
protected $_referenceMap = array(
'List' => array(
'columns' => 'task_list_id',
'refTableClass' => 'Application_Model_List',
'refColumns' => 'list_id'
)
);
}
I getUserLists
Bu gibi benim denetleyicisi içinde çağırır:
public function indexAction()
{
$lists = new Application_Model_List();
$userLists = $lists->getUserLists(1);
$this->view->lists = $userLists;
}
vepass it to my view vethen call findDependentRowset
like this:
foreach($this->lists as $list){
echo $list->list_title;
$tasks = $list->findDependentRowset('Application_Model_Task');
foreach($tasks as $task){
echo $task->task_title;
}
}
ama sorun sadece olanları nerede fıkra uymayan, bağımlı tablodan tüm rowsets çıkışlarının