这是我的控制者:
class SomeController extends AbstractActionController
{
protected $productTable;
protected $imageTable;
public function indexAction()
{
return new ViewModel(array(
'products' => $this->getProductTable()->fetchAll(),
'images' => $this->getImageTable()->fetchAll(),
));
}
}
下面的代码首先是我的观点,它运作正常
<?php foreach ($products as $product) : ?>
// Some code to display product, but not image
<?php endforeach; ?>
接下来我想为我的产品添加图片
<?php foreach ($products as $product) : ?>
<?php foreach ($images as $image) : ?>
// Some code to display product and image
<?php endforeach; ?>
<?php endforeach; ?>
它给了我这个例外:
This result is a forward only result set, calling rewind() after
moving forward is not supported.
如果我不知道循环它工作正常。 感谢阅读和对不起或我的英语不好。