Log changes done through web the interface

Hello,

I wonder if someone has any easy solution of how to do the following task:

Assume a large application written in Yii. There are several forms which will case changes to the database. Is it possible to add code to the controlloer and/or the model that will log the changes that users of the application do to the database?

Lets think that the application handles images and a user edit the information for an image. Among the data that is being modified through the interface is "title", "ISO-value" and "date". The code shall then log to a file (or by sending an email to a given address) that the image with ID xxx has been changed and that the columns "title", "iso_value" and "date_take" has been modified.

How can this be done. Please keep in mind that there might be several forms and tables that has to bee monitored for changes.

I have previously been working with a large project in symfony framework and it took me about 30 minutes to implement such a feature in symfony valid for any table. I hope Yii is flexible enough to have the same possibilities.

Thanks in advance :)

Don’t know any magic methods… just put manually inside every place to log it, You can create separate file for some category, so this is the way to go, log to some special category all what you want…

Possibly useful "tags": Yii::log, CEmailLogRoute, CActiveRecordBehavior, beforeSave/afterSave event, findByPK

/Tommy

This may help you

http://www.yiiframework.com/wiki/9/how-to-log-changes-of-activerecords/

Thanks, this may be a way to find a solution. However, the problem is a bit more complex than just recording changed fields in one table. Sometimes more than one table is involved in an update.