Gii Merge not overwrite

Hi all I very new to yii and I must say im loving it so far. Yet I do have one concern, I noticed that whenever I make changes to my Database and i need the changes to reflect on my Model Class, I either have to do it manually or use gii. But then gii over writes my whole file possibly deleting some custom code that i might have had.

Is there a way to make to enable gii to merge code instead of overwriting nd replacing the whole file?

If not can this be considered as a future feature, well thats if the community is also having the same problems, also if anyone has a work around can you please post it on here.

PS: Am I correct for having extra code in my Model class to begin with, or is it advisable to add all extra code in my controller?

+1

This is number 1 on my list of things that need to be added/changed. Or better yet, when ever the database is changed have Gii auto update models while still keeping custom changes. This would be soooo sweet.

You can achieve this by having Gii generate base classes, e.g. BaseUser that you then extend with your custom code. That way you make your changes in the User model and if you need to regenerate with Gii, you generate a new BaseUser and you don’t need to touch your code.

Auto update is a good idea…

Ok not sure why i didnt think of this… will have to do it this way thanks…

Giix does this already (Gii Extended) - personally, I like to do this by hand, but I can see your point.

Worth to mention that Giix is a fork of Gii Template Collection and that the Giix fork seems to suffer from a lack of activity currently.