Solved: This result is a forward only result set, calling rewind() after moving forward is not supported

Do you get this error: This result is a forward only result set, calling rewind() after moving forward is not supported with Zend Framework?

Today I will explain how you can solve this error.

So, I have a model called Categories. In my model I have this code:

$categories = $this->tableGateway->select(function(Select $select){
$select->order('categoryOrder ASC');
});
return $categories;

Now, I want to display the categories in several places on a page and I get the error: This result is a forward only result set, calling rewind() after moving forward is not supported

To solve this error, I will add $categories->buffer();

$categories = $this->tableGateway->select(function(Select $select){
$select->order('categoryOrder ASC');
});
$categories->buffer();
return $categories;









Leave a Comment