我對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無法在任何地方找到答案... 如果有人有這樣一個小應用程序,你不介意分享,我會很高興。
如果我不清楚我的問題,請詢問!
謝謝你的幫助。