2

i want to generate Model and CRUD automatically when my new table created.

i am creating new table(xyz_uid) dynamically after successful registration of user. and i am inserting some data related to that particular user. this thing is working fine for me.

i creating separate table for each user because for every user table attributes may different and i tried to keep one table instead of making new table for every user but it's smashing everything in my project.

i want to generate Model and CRUD of that user so i can do future transaction with that table.

i know how to generate Gii manually from ?r=gii. but here i want to generate automatically from back end.

i tried to search about this in Yii forum and in google also. but i didn't found anything.

is there any extension or anything which will generate it automatically.

will it be good idea to create model and CRUD for every table? or shall i communicate with table directly using CDbCommand?

404 Not Found
  • 1,223
  • 2
  • 22
  • 31
  • 1
    @DanielVaquero Gii has nothing to do with this question. Please read carefully. – Samuel Liew Sep 02 '13 at 06:28
  • 1
    Would be good if you can justify the reason for one user per table, instead of re-using the same table. http://stackoverflow.com/questions/7544544/database-efficiency-table-per-user-vs-table-of-users – Samuel Liew Sep 02 '13 at 06:30
  • i know how to generate gii from index.php?r=gii @DanielVaquero here i want to generate automatically in back end only when my new is created. – 404 Not Found Sep 02 '13 at 06:31
  • 1
    Please edit/update your question directly instead of posting more information in comments. – Samuel Liew Sep 02 '13 at 06:38
  • 1
    This entire idea sounds very very wrong. But if you *must* use this architecture, look at the code in Gii, and copy it to suit your needs - it just collects information from the table and creates a code file based on a template. – DCoder Sep 02 '13 at 06:58

1 Answers1

1

you may use giix-core.

While You install the giix-core it's create the model and basemodel so if u have any changes in DB every time u can create the basemodel not a model.

so it's easy working and u can use method override.

Note: Please make sure you can not write any code in BaseModel

for more please refer following link...

http://www.yiiframework.com/forum/index.php/topic/13154-giix-%E2%80%94-gii-extended/

Kalpit
  • 4,906
  • 4
  • 25
  • 43