Zend framework2 选择时ZF2 tablegateway显示错误“未知列”

Zend framework2 选择时ZF2 tablegateway显示错误“未知列”,zend-framework2,Zend Framework2,标题说明了这一点。 它说我没有“用户id”栏,但我有。它与“id”一起工作 这就是问题函数: public function getUploadsByUserId($userId) { $userId = (int) $userId; $rowset = $this->tableGateway->select( array('user_id' => $userId)); return $rowset; } 这就是模型: namesp

标题说明了这一点。 它说我没有“用户id”栏,但我有。它与“id”一起工作

这就是问题函数:

public function getUploadsByUserId($userId)
{
    $userId = (int) $userId;
    $rowset = $this->tableGateway->select(
        array('user_id' => $userId));


    return $rowset;
}
这就是模型:

namespace Users\Model;

use Zend\View\Model\ConsoleModel;

class Upload
{
public $id;
public $filename;
public $label;
public $user_id;


public function getArrayCopy()
{
    return get_object_vars($this);
}

function exchangeArray($data)
{
    $this->id = (isset($data['id'])) ? $data['id'] : null;
    $this->filename = (isset($data['filename'])) ? $data['filename'] : null;
    $this->label = (isset($data['label'])) ? $data['label'] : null;
    $this->user_id = (isset($data['user_id'])) ? $data['user_id'] : null;

}
}

这里哪里有问题,很明显我有这样的专栏。

问题是我没有正确配置tablegateway。它是“用户”而不是“上传”

 'UploadTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Upload());

                    return new TableGateway('uploads', $dbAdapter, null,
                        $resultSetPrototype);
                },

您可以共享表模式吗?问题已解决。这是一个小错误。您可以批准您的答案。