ZF2 模块最佳实践 [英] ZF2 module best practices
问题描述
Zend Framework 的新模块系统在第 2 版中被接受的最佳实践是什么?我的意图是为我的应用程序为每个控制器创建一个模块,还是应该使用这些模块以某种方式将相关控制器及其模型组合在一起?
What is the accepted best practice with the Zend Framework's new module system in version 2? Is it the intention that I create one module per controller for my application, or am I supposed to use the modules to group related controllers and their models together in some way?
推荐答案
参见 Rob Allens 模块介绍 或 Matthews 介绍模块.
简而言之:一个模块就是一堆执行一个特定任务的类.即:Guestbook
可以是一个模块.GuestbookMailing
可以是另一个模块(但不是必须).您的模块中可以有多个控制器、模型、视图.但它应该与整个应用程序的一部分相关联.
In Short: A module is simply a bunch of Classes that perform one specific task. I.E.: A Guestbook
could be one Module. GuestbookMailing
could be another module (but doesn't need to be). You can have multiple Controllers, Models, Views in your Module. But it should be all tied to one part of your whole application.
这篇关于ZF2 模块最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!