实现ModuleManagerInterface

时间:2015-09-22 16:24:45

标签: zend-framework2

从一个新的ZF2项目开始,得到以下错误

  

传递给ZendDeveloperTools \ Module :: init()的参数1必须实现接口Zend \ ModuleManager \ ModuleManagerInterface,null给定,在第33行的/vendor/zendframework/zend-modulemanager/src/Listener/InitTrigger.php中调用并定义在第34行的/vendor/zendframework/zend-developer-tools/src/ZendDeveloperTools/Module.php

哪个模块在application.config.php中的第一个并不重要。我总是遇到这个错误。

1 个答案:

答案 0 :(得分:0)

这是我的Module.php文件。该错误表明您需要在$parent = null; array_walk($_POST, function(value, key){ if (is_array($value) && class_exists($key)) { $object = new $key($value); if(!empty($parent)){ $parent->$key()->save($object); // function author(){$this->hasOne('author');} on blog_post model } else{ $object->save(); } $parent = $object; } }); 方法中传递ModuleManagerInterface作为第一个参数。 init方法有一个接口。查看init文件,您将看到错误。

Zend\ModuleManager\Feature\*Interface.php