I think you have your concepts mixed up. Read over the three basic elements of an MVC framework:
Controllers: http://manual.cakephp.org/chapter/controllers Models: http://manual.cakephp.org/chapter/models Views: http://manual.cakephp.org/chapter/views Controllers have $action, not models. The way to do your thing would be: function beforeSave() { if (empty($this->id)) { // Adding (not editing) } return parent::beforeSave(); } -MI --------------------------------------------------------------------------- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -----Mensaje original----- De: [email protected] [mailto:[EMAIL PROTECTED] En nombre de varunkrish Enviado el: Domingo, 25 de Marzo de 2007 08:57 a.m. Para: Cake PHP Asunto: re:use beforeSave only in add action function beforeSave() { if($this->data){ if($this->action=="add"){ //load stuff } } this throws Notice: Undefined property: Product::$action --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
