2012-12-02 23:09
浏览 23

无法访问Zend Framework 2中的ServiceManager

I'm on 2.0.4.

My files:


According to the documentation at http://framework.zend.com/manual/2.0/en/modules/zend.service-manager.quick-start.html

If a class implements ServiceManagerAwareInterface, then its object will be initialized with the service manager. I did the same (see BaseEntity.php in my source code). However, the service manager was never initialised and is thus unavailable from the subclass Snippet.

Question: How to retrieve the global or module's ServireManager instance, so that I can access other services? (Most of them are singleton)

图片转代码服务由CSDN问答提供 功能建议

我在2.0.4。</ p>

我的文件:</ p>

https://gist.github.com/4191490 </ p >

根据 http://framework.zend.com/manual/2.0/en/modules/zend.service-manager.quick-start.html </ p>

如果是 class实现ServiceManagerAwareInterface,然后使用服务管理器初始化其对象。 我做了同样的事情(参见我的源代码中的BaseEntity.php)。 但是,服务管理器从未初始化,因此无法从子类Snippet中获取。</ p>

问题:如何检索全局或模块的ServireManager实例,以便我可以访问其他服务? (大多数是单身人士)</ p> </ div>

2条回答 默认 最新

相关推荐 更多相似问题