<code>
$resultSet = $this->tableGateway->select ( function ($select) {
$select->columns (
array (
'id',
'category_name'
) );
} );
tried with above code but it returning all columns, below is the output of return. I need to select id and category_name from database
Category\Model\Category Object
(
[id] => 2
[category_name] => Cat Two
[category_created] =>
[category_status] =>
[inputFilter:protected] =>
)
Category\Model\Category Object
(
[id] => 4
[category_name] => Cat one
[category_created] =>
[category_status] =>
[inputFilter:protected] =>
)
I had this problem. I think it might be because the function is being ignored inside the first select function and it just just returning everything. I found a way to get this to work, try something like the following:
Use the Select class along with the selectWith function of the tablegateway: