Re: R: Auditing

2007-08-21 Thread alan
I think it would be useful for you to look through the API. http://api.cakephp.org/model__php5_8php-source.html#l00771 specifically: 00842 if (count($fields)) { 00843 if (!empty($this->id)) { 00844 if ($db->update($this, $fields, $values)) { 00845

Re: R: Auditing

2007-08-21 Thread zipman
The problem although is that still I do not have access to the new row,namely I don't know what field was updated. Is there any way to do this without triggers? On Aug 21, 4:19 pm, zipman <[EMAIL PROTECTED]> wrote: > Thanks a lot guys. I am using postgres and cakephp 1.1 > and I think I'd rather

Re: R: Auditing

2007-08-21 Thread zipman
Thanks a lot guys. I am using postgres and cakephp 1.1 and I think I'd rather first try the approach m.sbragi suggested. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send

Re: R: Auditing

2007-08-20 Thread szeta
Yep, that's how I added a history to my last project. E.g. to check if somebody changed his last_name (married? ;-) DELIMITER // create trigger contact_update AFTER UPDATE ON contact FOR EACH ROW BEGIN IF new.Last_Name != old.Last_Name THEN INSERT INTO contact_history(`Contact_ID`,`Type`,`Actio

Re: R: Auditing

2007-08-20 Thread RichardAtHome
If you are using a later version of MySQL (>= 5.0.2), you could add a database trigger (ON UPDATE, ON DELETE, etc.) to log changes automatically without having to change your code. See: http://dev.mysql.com/doc/refman/5.0/en/triggers.html On Aug 20, 11:59 am, <[EMAIL PROTECTED]> wrote: > This m

R: Auditing

2007-08-20 Thread m.sbragi
This my attempt to solve the problem (logfile is a table for auditing): function beforeSave() { $this->currentAction = $this->id ? 'Update' : 'Insert'; return true; } function afterSave() { // hope that this is not necessary // because cake has filled in the id after save