Hey guys,
Right now I am extending the CActiveRecord class in my models, this in order to be able to tell when changes where made to my model between find and save.
I am doing this by adding an old_attributes property and assigning it on afterFind() and then comparing it to my array on beforeSave().
This works OK for me, but I feel that this is colliding with the correct workflow for creating yii models and controllers using gii.
In my typical flow, I would make small incremental changes to my database tables (happens, you know), and each time re-generate the model and curd using gii.
What would happen then is obviously my model files will be overwritten and everything lost.
I don’t know whether this is a feature request or if anyone has an existing solution, but I am looking for a way in which gii will not overwrite MY changes to the models/curd.
In apple’s cocoa, for example, you can add methods to a class without actually subclassing it. It is called categories and these methods are stored in a separate file, so if you regenerate your code using their auto-generator, your code isn’t overwritten.
I read somewhere that you can simply change the template used by gii. Is this a solution? how do you do this?
Thanks
Ilan