douping6871 2014-01-27 01:56
浏览 41
已采纳

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!

  • 写回答

1条回答 默认 最新

  • douxiong1994 2014-01-27 02:09
    关注

    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',
        ),
        /...
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题