Do something whenever value of a field is changed
Archived from the Xataface Users forum.
hhkilis — Mon Apr 02, 2012 6:21 am
Hi,
I want Xataface to execute some commands whenever value of a field is changed.
How can I handle this?
I know that there are two triggers available to be implemented in a table’s delegate class. (AfterUpdate and AfterSave) Problem is I don’t know how to understand that value of a field is changed during execution of one of these triggers since I can only see the last value either updated or not from the database?
shannah — Mon Apr 02, 2012 9:40 am
In the beforeSave, beforeUpdate, and beforeInsert triggers you can check for changed values.
e.g.
- Code: Select all
beforeSave($record){ if ( $record->valueChanged('myfield') ){ // Do something .. the value for the field 'myfield' has been changed. } }
hhkilis — Tue Apr 03, 2012 3:36 am
Thanks