ZF2-289: TableGateway select() has no option to choose which columns will be fetched

Issue Type: 1.x to 2.x Integration Created: 2012-05-06T01:35:56.000+0000 Last Updated: 2012-05-08T21:54:46.000+0000 Status: Resolved Fix version(s): Reporter: Gencer (gencer) Assignee: Ralph Schindler (ralph) Tags: - Zend\Db

  • Zend_Db

Related issues: Attachments:


$emails = new TableGateway('emails', $adapter); $rowset = $emails->select(array('idx' => 8081));

returns all columns inside of the emails table. Instead of this i want to only fetch only TWO column. ZF1 has option "from('emails', 'column_id') but ZF2 not.

Query to create: SELECT id, log FROM emails WHERE idx = 8081


Posted by Ralph Schindler (ralph) on 2012-05-08T21:54:46.000+0000

Try this:

<pre class="highlight">
$table->select(function ($select) {
  $select->columns(array('col1', 'col2'));

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.