ZF2谷歌地图模块 - Zend \ ServiceManager \ ServiceManager :: get无法为GMaps \ Service \ GoogleMap获取或创建实例

ZF2谷歌地图模块 -  Zend \ ServiceManager \ ServiceManager :: get无法为GMaps \ Service \ GoogleMap获取或创建实例

问题描述:

I'm trying to use this module, https://github.com/gowsram/zf2-google-maps- , but I'm running into a problem.

Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for GMaps\Service\GoogleMap

I have followed the instruction in the github readme, and have cloned the project into my vendors directory.

From what I understand, the line which calls the ServiceLocator,

$map = $this->getServiceLocator()->get('GMaps\Service\GoogleMap');

isn't pointing to the right place. Unfortunately my knowledge of how the service locator works isn't deep enough to figure out how to fix the problem, despite attempts to remedy this by diving into the docs. It's all a little over my head.

Thanks for any input you may be able to provide!

我正在尝试使用此模块, https://github.com/gowsram/z​​f2-google-maps- ,但我遇到了问题。 p> \ n

  Zend \ ServiceManager \ ServiceManager :: get无法为GMaps \ Service \ GoogleMap提取或创建实例
  code>  pre> 
 
 

我已经关注了 github自述文件中的指令,并将项目克隆到我的vendor目录中。 p>

根据我的理解,调用ServiceLocator的行, p>

  $ map = $ this-> getServiceLocator() - &gt  ; get('GMaps \ Service \ GoogleMap'); 
  code>  pre> 
 
 

未指向正确的位置。 不幸的是,我对服务定位器如何工作的了解并不足以弄清楚如何解决问题,尽管试图通过深入研究文档来解决这个问题。 这一切都在我脑海中。 p>

感谢您提供的任何输入! p> div>

Have you edited your application.config.php file so that the modules array contains GMaps? From the look of the error, the module isn't running since the service is not registered with the ServiceManager.

That step appeared to be skipped over in the installation instructions but you should add it to your application config so it runs the module's Module.php code.

application.config.php

return array(
    'modules' => array(
        'Application',
        'GMaps',
    ),
    /...
);