Module Development Guide


I have some questions…

  1. When creating a module (via yiic), how can I create it’s model?. Right now, If I create a model via yiic, it is stored inside application model (not module’s model)…

  2. How to make a connected module?

example: (from yii-blog-guide)… I want to make 3 modules: User Management, Blogs, and Comment. The Comment module can be attached to the Blogs module (so user can make comment to posts created from Blogs module). And in the future if I create News module, then the Comment module previously created, can be attached to the News module too…(so user can make comment to the News)…

Thanks for any info.

I found that creating a model for a module works wrong for me, when I try to create it via yiic being in yii/framework directory. But the command “model moduleId.models.modelId” works fine when I call it from yiic being in my application’s protected directory. Maybe something is wrong with my configuration, but the first command does not put model into module’s models directory.

About the second question… Since the comment module is non independent you have to create a submodule for your News module (afaik it is possible in yii, but I didn’t practice it yet :) ) .

It works. Thanks!. and the CRUD command: "crud moduleId.models.modelId"

so basically if I want a module uses Comment module, I have to create Comment as submodule. Does this mean I have to create another CRUD for Comment module (as sub-module) too ?

Personally i don’t use the yiic at all. But i do use modules extensively. In fact i made a really well designed module structure that allows me to add as many modules as i want each will have it’s own settings, rules, routes, theme, language, models, views, layouts etc. I am still working on getting a screen cast done on working with modules, But i am still in the process on making that screen cast. I am also using Yii framework along side with Zend Framework, Yii MVC architecture and all classes it offers and Zends components as an additional third party components. So i can benefit from both.

there are nice commands “help” and “help module” ;)

maybe I didn’t get your question… but if you need crud operations for comments then you should create CRUD.

maybe something like this

nice… I hope there will be hints about creating a reuseable modules too…