嗨,我对 Zend Framework 2 有疑问。
File:
/home/marketplace/htdocs/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:240
Message:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "users" does not exist
LINE 1: ...ELECT COUNT(1) AS "c" FROM (SELECT "users".* FROM "users") A...
^
在我的模型中,我有
public function fetchAll($paginated=false)
{
if($paginated) {
$select = new Select('users');
$select->order('id DESC');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new User());
$paginatorAdapter = new DbSelect(
$select,
$this->tableGateway->getAdapter(),
$resultSetPrototype
);
$paginator = new Paginator($paginatorAdapter);
return $paginator;
}
$resultSet = $this->tableGateway->select(function(Select $select){
$select->limit('30')->order('id DESC');
});
return $resultSet;
}
奇怪的是,在语言环境服务器中一切正常......有什么建议可以在哪里找到问题?谢谢
更新:
如果我直接做同样的查询,
$sql = 'SELECT COUNT(1) AS "c" FROM (SELECT "users".* FROM "users") AS "original_select"';
$resultSet = $this->tableGateway->getAdapter()->query($sql);
return $resultSet;
一切都好。