如何在 Zend Framework 2 中查看 TableGateway 生成的数据库查询 [英] How to view db queries generated by TableGateway in Zend Framework 2
问题描述
我是 ZF2 的新手,正在尝试使用 tableGateway 来管理和更新数据库中的条目.我可以毫无问题地选择和更新项目,但在插入时出现错误.由于 tableGateway 类动态创建查询,我如何才能看到查询本身?
I am brand new to ZF2 and am trying to use a tableGateway to manage and update entries in a database. I am able to select and update items without a problem, but when inserting I get an error. Since the tableGateway class creates the query on the fly, how can I see the query itself?
$this->tableGateway->insert($data);
执行过程中发生错误;请稍后再试.附加信息:Zend\Db\Adapter\Exception\InvalidQueryException
An error occurred during execution; please try again later. Additional information: Zend\Db\Adapter\Exception\InvalidQueryException
文件:
/[redacted]/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:220
留言:
Statement could not be executed
推荐答案
使用 zend-developer-tools 非常优雅的查看数据库查询的方式.
Very elegant way how to see db queries is to use zend-developer-tools.
最简单的使用方法是将模块添加到 composer.json 文件中来安装
Easiest way how to use it is to install module by adding it to composer.json file
<代码>.....存储库":[{类型":作曲家","url": "http://packages.zendframework.com/"}],要求": {"php": ">=5.3.3","zendframework/zend-developer-tools": "dev-master"}
这篇关于如何在 Zend Framework 2 中查看 TableGateway 生成的数据库查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!