Hi guys, my app need to write into a log table for every successful
update/delete operation, my current approach is to put the code in
AfterFilter in AppController, the problem is, how do I get / know a
successful update/delete has been done?
Or is there any other suggestions to do this? Thanks.
I don't know if these applies to you... but saves (I don't know if just
valid ones) do a callback to the model's aftersave function (either inserts
or updates)
> Hi guys, my app need to write into a log table for every successful
> update/delete operation, my current approach is to put the code in
> AfterFilter in AppController, the problem is, how do I get / know a
> successful update/delete has been done?
> Or is there any other suggestions to do this? Thanks.
Yes, I can use the model's callback method (aftersave and afterdelete) but then, since this would require writing to another table, which means call to other model from inside a model, wouldn't this break the MVC pattern?
Lavin<carloslavi...@gmail.com> wrote: > I don't know if these applies to you... but saves (I don't know if just > valid ones) do a callback to the model's aftersave function (either inserts > or updates) > A bit more info on it: > http://book.cakephp.org/view/684/afterSave
You could use the logablebehavior I have used it and it is really
excellent!! It even integrates with auth component so you can log and
see who did what. It can also log inserts too.
> Hi guys, my app need to write into a log table for every successful
> update/delete operation, my current approach is to put the code in
> AfterFilter in AppController, the problem is, how do I get / know a
> successful update/delete has been done?
> Or is there any other suggestions to do this? Thanks.
-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of satyavirya
Sent: Saturday, 4 July 2009 4:18 a.m.
To: CakePHP
Subject: Write to log table for every successful update/delete
Hi guys, my app need to write into a log table for every successful
update/delete operation, my current approach is to put the code in
AfterFilter in AppController, the problem is, how do I get / know a
successful update/delete has been done?
Or is there any other suggestions to do this? Thanks.
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4214 (20090703) __________
Anyway... we do a lot of logging of record creation etc to the db for
various reasons and ideally a behavior is what your after, but for a quick
solution its easy enough to call the log model on the fly in your model
callbacks like
That's a pretty crude example but nothing wrong with doing it that way if it
fits your needs. If you were to be doing this in your app model to trigger
on all models, be sure to stop the callback on your log model save,
otherwise it will eternally log it self to death.
-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of satyavirya
Sent: Saturday, 4 July 2009 4:18 a.m.
To: CakePHP
Subject: Write to log table for every successful update/delete
Hi guys, my app need to write into a log table for every successful
update/delete operation, my current approach is to put the code in
AfterFilter in AppController, the problem is, how do I get / know a
successful update/delete has been done?
Or is there any other suggestions to do this? Thanks.
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4214 (20090703) __________
On Sat, Jul 4, 2009 at 6:25 AM, BlueC<messageforch...@googlemail.com> wrote: > You could use the logablebehavior I have used it and it is really > excellent!! It even integrates with auth component so you can log and > see who did what. It can also log inserts too.