Re: Logging changes made on "edit" action
Never mind, I got it, app->models->behaviors->Logable.php needs to be app->models->behaviors->logable.php an hour wasted for a god damn lower case L. Hehehehe, back to work :D! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Logging changes made on "edit" action
Hey, I'm pretty sure I have set up everything correctly, but this is not working out to well for me. The logable Behavior never gets called... I must say I have never worked with behaviors before and these next few lines may sounds very "noobish" this is how I set it up: --- in each model needed I have added : var $actsAs = array("Logable"); --- added the Behavior code in: app->models->behaviors->Logable.php --- added this to the app_controller->beforeFilter: if (sizeof($this->uses) && $this->{$this->modelClass}->Behaviors- >attached('Logable')) { $this->{$this->modelClass}->setUserData($this->activeUser); } --- created my logs table: CREATE TABLE `logs` ( `id` bigint(10), `title` varchar(255), `created` datetime, `description` varchar(255), `model` varchar(255), `action` varchar(255), `change` varchar(255) ); and finally created a log model (log.php): Could anyone tell me what am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Logging changes made on "edit" action
Thanks Chris, I knew there must of been something already written for this. Will go try it out!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Logging changes made on "edit" action
Stu, that would be one way but I suggest save yourself a whole load of hassle and use the existing logable behavior addon: http://code.google.com/p/alkemann/wiki/LogableBehavior http://bakery.cakephp.org/articles/view/logablebehavior I have used it in a recent app and it works really very nicely indeed. Chris On Jun 10, 8:39 pm, Stu wrote: > ps: > > I was thinking of adding the logic here: > > app_model.php > -- > > afterSave($created){ > if(!$created){ > //logic goes here > } > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Logging changes made on "edit" action
ps: I was thinking of adding the logic here: app_model.php -- afterSave($created){ if(!$created){ //logic goes here } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Logging changes made on "edit" action
Hey all, I need to log changes made to a table on each entries. I'm using cake's 'edit' action. so every time someone edits something, I need to log it to the table which will look like: log - id - table_name - user_id - date/time - modifications I have a pretty good idea on how to code this but I was wondering if anyone ever used a component for this somewhere or if there is a cake way to do it. Maybe someone could tell me where would be the best place to do this. Any ideas would be appreciated. Please let me know if I wasn't clear enough on what I want to accomplish here. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---