title: zendframework 2 select max of a column
body: <p>I'm using ZendFramework 2 and TableGateway which is fine for normal select statements. But I can't seem to find how to get a max of a column using ZendFramework 2 select. 
  My select should look something like</p>
  
  <pre><code>SELECT MAX( `publication_nr` ) AS maxPubNr FROM `publications` 
  </code></pre>
  
  <p>and my code looks like:</p>
  
  <pre><code>use Zend\Db\TableGateway\TableGateway;
  class PublicationsTable
  {
  protected $tableGateway;
  ...
  public function getMaxPubicationNr()
  {
      $rowset = $this-&gt;tableGateway-&gt;select(array('maxPubNr' =&gt; new Expression('MAX(publication_nr)')));
      $row = $rowset-&gt;current();
      if (!$row) {
          throw new \Exception("Could not retrieve max Publication nr");
      }
      return $row;
  }
  </code></pre>