我对ZF模块和模型的结构有一些疑问。Zend Framework 2上的模块和模型组织
(我说的是ZF 2,因为我放弃了ZF 1.11)
为了使我的问题,简单易懂,看看下面的例子: (我创建这个只是为了学习ZF2)
这是一个“电影管理器应用程序”。 在这个应用我有3种用户:
- visitors: peolple who olny can see the movies in the database.
- members: same as visitors plus insert, update and delete movies.
- administrator: same as members plus insert, update and delete users and other informations as genre, artist, ...
会员可以比新电影罢了无法插入,我。即他们不能 插入新的流派,既不是新的艺术家。
确定...对于这个问题,我发现这个解决方案:
- create 3 modules: visitor, member, admin;
,但我不知道这是否是组织去计划的最佳途径......
我意识到,ZF预计人们组织应用程序是这样的:
- create modules for each funcionallity;
- create roles for each kind of user;
所以,我的问题是:
1. My solution is right or wrong?
2. If my solution is right, how can I organize my application?
3. How can I organize my models, to be visible to more than one module?
- I think a should create a model "movie" somewhere if "inserts, updates, deletes, and selects"
then a module "visitor" could only use a "select" while a module "member" could use all the funcionallities. Am I right?
4. If my solution is not right, how can I organize my application?
5. How should be my modules?
我真的坚持这个问题。 A无法在任何地方找到答案... 如果有人有这样一个小应用程序,你不介意分享,我会很高兴。
如果我不清楚我的问题,请询问!
谢谢你的帮助。