Reputation: 1305
I need get the MySql query executed before Save, Update, Delete for create a personal LOG (audit).
I use $model->save() and $model->delete() standard from CActiveRecord.
Any know how i can do this?
Thanks to all!
Upvotes: 0
Views: 1312
Reputation: 1871
You can use the methods
class Objects extends CActiveRecord
{
protected function beforeSave()
{
// Your code goes here
}
protected function beforeDelete()
{
// Your code goes here
}
}
For Logging of query you refer this thread Logging
u can also see the log on the page by just uncommenting the follwing code in config.main file
// uncomment the following to show log messages on web pages
array(
'class'=>'CWebLogRoute',
),
Upvotes: 2