首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CakePHP和Mognodb

CakePHP和Mognodb
EN

Stack Overflow用户
提问于 2012-12-16 04:04:59
回答 1查看 1.4K关注 0票数 1

我使用的是CakePHP 2.2.4和MongoDB2.2.2

我已经处理了几个问题,但是在cakephp主页上有以下错误

代码语言:javascript
运行
复制
Strict (2048): Declaration of MongodbSource::execute() should be compatible with DboSource::execute($sql, $options = Array, $params = Array) [APP/Plugin/Mongodb/Model/Datasource/MongodbSource.php, line 36]

对于这些函数声明,我得到了类似的错误。

  • 资料来源::query()
  • 资料来源::create()
  • 资料来源::read()
  • 资料来源::update()
  • 资料来源::删除()
  • 资料来源::计算()
  • 资料来源::group()
  • 资料来源::dropSchema()
  • 资料来源::describe()

MongodbSource扩展DbSource

在DbSource中:

代码语言:javascript
运行
复制
public function execute($sql, $options = array(), $params = array()) { <code here> }

在MongodbSource中:

代码语言:javascript
运行
复制
public function execute($query, $params = array()) { <code here> }

我有点理解发生了什么,但我不知道该如何解决。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-16 06:45:27

重写父方法的方法应该实现相同的参数,即execute方法在MongodbSource中的签名应该是:

代码语言:javascript
运行
复制
public function execute($sql, $options = array(), $params = array())

另请参阅:

Declaration of Methods should be Compatible with Parent Methods in PHP

https://www.google.com/search?q=php+Declaration+of+should+be+compatible+with

http://php.net/manual/en/migration51.oop.php#migration51.oop-inheritance

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13898511

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档