Difference between #3 and #4 of
How to log changes of ActiveRecords?

Revision #4 has been created by pfth on Feb 13, 2009, 12:40:14 PM with the memo:

Added PHP code format
« previous (#3) next (#5) »

Changes

Title unchanged

How to log changes of ActiveRecords?

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
The behavior class uses the ActiveRecordLog Model to store the log lines into the database. It will log a line each time a record is inserted or deleted. It will also log a line for each field which is changed.

In order to make an ActiveRecord Model use this behavior, you have to add the following code to the Model class:

     
```php 
public function behaviors()
{
return array(
[...]
);
}
```

Of course this simple example could be enhanced:

+ support for mult-column primary keys
+ savethe attributeLabels instead of the field names
[...]
31 1
47 followers
Viewed: 74 191 times
Version: 1.1
Category: Tutorials
Tags: Logging
Written by: pfth
Last updated by: Yang He
Created on: Feb 13, 2009
Last updated: 12 years ago
Update Article

Revisions

View all history