【发布时间】:2012-06-03 12:02:06
【问题描述】:
我想开始使用Zend Framework 2 并需要一些关于框架架构的指导。我将Akrabat's ZF2 tutorial 与ZF1 equivalent 进行了比较,到目前为止我注意到的主要区别似乎是modules 的使用。我喜欢将模块作为独立且可重用的代码片段的想法,并且我认为它可以帮助分割我的应用程序并使其更易于维护。例如,我可以有以下URL => module 映射:
http://example.org/products => Products module
http://example.org/services => Services module
http://example.org/oauth => Oauth module
[...]
我感到困惑的是,我的一些模块将共享相同的底层数据库资源(例如,Products 和 Services 对 cmets 使用相同的表),因此使用相同的数据库模型。因此,我想知道:
当我的数据库模型被多个模块使用时,我应该把它们放在哪里?
【问题讨论】:
标签: php model-view-controller zend-framework architecture