Extending Yii models

Hello everyone,

Imagine we have a model based on a database table in our application. Since we are in the design phase, the table may change later and thus the model should be re-created by Gii again.

Is it possible to extend a model from Gii and use that to update database? I would like to add some validation rules in that Gii does not include in my model. If the answer to the above question is yes, then do we need to for instance, override the whole rules function or is there a way where I can only add a few rules in my extended class and set it up such that it returns those additional rules in addition to the rules that are returned from the original model generated by Gii?

Thanks! =)

there is one false assumption here that you have to use Gii again. This is a scaffolding approach and you use Gii only at the beginning (building basic functionality). After that you apply every changes by hand. You can use BaseModel pattern (provided by GiiX) to recreate BaseModels on change, however it will (almost always) still need some fine tuning by hand…