Working on Models extended from Gii generated models

Hello,

I was wondering whether this is a recommended flow:

  1. I use Gii to create models based on my tables.

  2. I name the models as yii*, e.g. yiiPost.

  3. I extend yiiPost through Post and carry out further customisations in Post.

This is inspired in part by symfony (as much as I understood from its Jobeet tutorial) and because my tables are not yet frozen. As the requirements keep changing, I find myself regenerating the model classes and then working with the diff output to write new changes. In particular, the relations() keep getting left behind :( as in my rush, I do not update relations in models where I know I won’t be using them. With this two-step way, since the original files are not modified, getting them regenerated will be a simpler faster job.

Regards to all.

Sounds great to me

Later on when they are stabler you could use migration feature

How do you (or rather what is the accepted way) handle tables whose design may change during development?

Migrations is neat! Definitely useful when I sync the project between home and office. Is there any way to call the migrations from the application, say, the admin interface? Because our hosting does not have shell access.

Thanks.

I do the same thing

What I did is to extend Gii to create like I want

theres actually an issue about it to be improved in 1.1.8

About the migration I wouldn’t know, someone more experienced in it might help you out

The solution is most probably to run shell commands using php

That’s good to hear regarding the base class idea. Also, for the current future, we don’t have shell access to the host, so I would be playing with Migration on local machines only.