Message: PartialLoop helper requires iterable data
Stack trace:
#0 [internal function]: Zend_View_Helper_PartialLoop->partialLoop('partials/ListaK...', Object(Model_Klasy))
#1 C:\xampp\php\PEAR\Zend\View\Abstract.php(342): call_user_func_array(Array, Array)
#2 [internal function]: Zend_View_Abstract->__call('partialLoop', Array)
#3 C:\xampp\htdocs\inzynierka\application\views\scripts\klasy\lista.phtml(9): Zend_View->partialLoop('partials/ListaK...', Object(Model_Klasy))
#4 C:\xampp\php\PEAR\Zend\View.php(108): include('C:\xampp\htdocs...')
#5 C:\xampp\php\PEAR\Zend\View\Abstract.php(880): Zend_View->_run('C:/xampp/htdocs...')
#6 C:\xampp\php\PEAR\Zend\Controller\Action\Helper\ViewRenderer.php(897): Zend_View_Abstract->render('klasy/lista.pht...')
#7 C:\xampp\php\PEAR\Zend\Controller\Action\Helper\ViewRenderer.php(918): Zend_Controller_Action_Helper_ViewRenderer->renderScript('klasy/lista.pht...', NULL)
#8 C:\xampp\php\PEAR\Zend\Controller\Action\Helper\ViewRenderer.php(957): Zend_Controller_Action_Helper_ViewRenderer->render()
#9 C:\xampp\php\PEAR\Zend\Controller\Action\HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#10 C:\xampp\php\PEAR\Zend\Controller\Action.php(523): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#11 C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('listaAction')
#12 C:\xampp\php\PEAR\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#13 C:\xampp\php\PEAR\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#14 C:\xampp\php\PEAR\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#15 C:\xampp\htdocs\inzynierka\public\index.php(26): Zend_Application->run()
#16 {main}
我正在尝试传递这些数据:
object(Model_Klasy)#76 (4)
{
["_id":"Model_Klasy":private]=> int(1)
["_rokRozpoczecia":"Model_Klasy":private]=> int(2010)
["_nazwa":"Model_Klasy":private]=> string(2) "1a"
["_Wychowawca":"Model_Klasy":private]=> int(9)
}
这是行动:
$modelLista = new Model_KlasyMapper();
$this->view->listaKlas = $modelLista->listaKlas();
观看:
echo $this->partialLoop('partials/ListaKlas.phtml', $this->listaKlas);
如何解决这个问题?可能很容易,但我累了:/
答案 0 :(得分:1)
你的对象需要支持一个像ArrayAccess或IteratorAggregate这样的可迭代接口的实现(尽管我认为即使是像Traversable这样简单的东西也能工作)。或者你可以让所有成员public
(不寒而栗)。
答案 1 :(得分:0)
所有这一切都是错误的,因为一个脑袋:)我讨厌错过的东西:P 之后,我可以在稍加修改后显示它:
<?php foreach ($this->listaKlas as $dane) : ?>
<td><?php echo $dane->getNazwa(); ?></td>
<td><?php echo $dane->getRokRozpoczecia(); ?></td>
<td><?php echo $dane->getWychowawca(); ?></td>
etc.