2012-11-22 11:18
浏览 66

如何在ZF2中的Zend \ ServiceManager中使用Zend \ Di?

I'm trying to make the Zend\ServiceManager use Zend\Di to create my instances, since I have pre-scanned and cached DI definitions already. I realize this might come with a speed penalty but on the other hand, I need to write a lot less meta-code.

The ServiceManager documentation says that

the ServiceManager also provides optional ties to Zend\Di, allowing Di to act as an initializer or an abstract factory for the manager.

But I don't find any examples of how make the ServiceManager use Zend\Di. I'm not even sure where I should set this up, maybe in Module::getServiceConfig()? Can anyone provide some example code?

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

我正在尝试让Zend \ ServiceManager使用Zend \ Di创建我的实例,因为我已预先 扫描和缓存DI定义已经。 我意识到这可能会带来速度损失,但另一方面,我需要编写更少的元代码。


ServiceManager还提供与Zend \ Di的可选绑定,允许Di 作为管理器的初始化器或抽象工厂。

但我不知道 找到如何使ServiceManager使用Zend \ Di的任何示例。 我甚至不确定我应该在哪里设置它,也许在Module :: getServiceConfig()中? 任何人都可以提供一些示例代码吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题