views:

26

answers:

1

I have these two models:

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);
    }

}

and

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 call getUserLists within my controller like this:

public function indexAction()
{
    $lists = new Application_Model_List();
    $userLists = $lists->getUserLists(1);
    $this->view->lists = $userLists;
}

and pass it to my view and then 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;
    }
}

but the problem is it outputs all rowsets from the dependent table, not just the ones matching the where clause

A: 

Oops. It turns out this was working but invalid HTML was hiding the output i was expecting

seengee