title: This result is a forward only result set, calling rewind() after moving forward is not supported - Zend
body: <p>In Zend app, I use <code>Zend\Db\TableGateway</code> and <code>Zend\Db\Sql</code> to retrieve data  data from MySQL database as below.</p>
  
  <p>Model -</p>
  
  <pre><code>public function getCandidateEduQualifications($id)
  {
      $id  = (int) $id;
  
      $rowset = $this-&gt;tableGateway-&gt;select(function (Sql\Select $select) use ($id)
      {
          $select-&gt;where
              -&gt;AND-&gt;NEST-&gt;equalTo('candidate_id', $id)
              -&gt;AND-&gt;equalTo('qualification_category', 'Educational');
      });
  
      return $rowset;
  }
  </code></pre>
  
  <p>View -</p>
  
  <p>I just iterate $rowset and echo in view. But it gives error when try to echo two or more times. Single iteration works.</p>
  
  <blockquote>
    <p>This result is a forward only result set, calling rewind() after
    moving forward is not supported</p>
  </blockquote>
  
  <p>I can solve it by loading it to another array in view. But is it the best way ? Is there any other way to handle this ?</p>
  
  <pre><code>$records = array();
  foreach ($edu_qualifications as $result) {
      $records[] = $result;
  }
  </code></pre>
  
  <p>EDIT -</p>
  
  <p><code>$resultSet-&gt;buffer();</code> solved the problem.</p>