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 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊