public function indexAction() { $polls = Model_Table_Poll::instance()->fetchAll(); $this->view->polls = array(); foreach ($polls as $poll) { $options = $poll->findDependentRowset('Model_Table_Poll_Option'); $this->view->polls[$poll->id]['question'] = $poll->question; $this->view->polls[$poll->id]['options'] = $options->toArray(); } }
/** * Retrieve all polls * * @return struct polls */ public static function getAllPolls() { $polls = Model_Table_Poll::instance()->fetchAll(); $ret = array(); foreach ($polls as $poll) { foreach ($poll->findDependentRowset('Model_Table_Poll_Option') as $option) { $ret[$poll->question][$option->key] = $option->text; } } return $ret; }