我对 ZF 模块和模型的结构有一些疑问。
(我说的是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 在任何地方都找不到答案...如果有人有像这样的小应用程序并且您不介意分享,我会很高兴。
如果我的问题不清楚,请提问!
谢谢您的帮助。