ZFモジュールとモデルの構造についていくつか質問があります。
(私はZF 1.11をあきらめたので、ZF 2について話している)
私の質問を理解しやすくするために、次の例を見てください:(私は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?
私は本当にこの問題にこだわった。どこにも答えが見つかりませんでした...誰かがこのような小さなアプリケーションを持っていて、共有してもかまわないのであれば、私は喜んでいます。
質問がよくわからない場合は、質問してください。
ご協力ありがとうございました。