Just need a hand understanding some simple database queries in ZF2. In ZF1 I have simple methods like this:
public function recordset()
{
// listing of all reco
From http://framework.zend.com/manual/2.0/en/modules/zend.db.result-set.html:
Zend\Db\ResultSet is a sub-component of Zend\Db for abstracting the iteration of rowset producing queries.
So you can do the following:
$statement = $db -> query($sql);
/** @var $results Zend\Db\ResultSet\ResultSet */
$results = $statement -> execute();
$returnArray = array();
// iterate through the rows
foreach ($results as $result) {
$returnArray[] = $result;
}
Now you can send it to the view:
return new ViewModel(array('results' => $returnArray));