2
<code>
$resultSet = $this->tableGateway->select (function ($select) {
$select->columns (
array (
'id',
'category_name'
));
尝试使用上面的代码,但它返回所有列,下面是返回的输出。我需要从数据库
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] => )
是什么问题?你告诉网关只选择'id'和'category_name',网关只填充这两个字段。那么你的问题究竟是什么,你想做什么? – Sam
这里我想检索只有id和category_name,但为什么类别状态和category_created来... –
因为你告诉你的'TableGateway'返回一个'类别'对象。然而,那些类别对象在所有其他字段上没有DATE,除了你想要的字段。所以我真的不知道你的问题是什么。 – Sam