hi i am trying to make a beforeSave function that is only invoked if
there is no membership id set (i.e. add not edit), however even in my
edit action where the id is set it is still being invoked, any idea
why? thanks

        function beforeSave() {
                if (!isset($this->data['Membership']['id'])) {
                        $role = $this->data['Membership']['role_id'];
                        $module = $this->data['Membership']['module_id'];
                        $user = $this->data['Membership']['user_id'];
                        $conditions = array("Membership.role_id"=>"$role",
                                                                
"Membership.module_id"=>"$module","Membership.user_id"=>"$user");
                        if ($this->find($conditions)) {
                                return false;
                        }
                        else return true;
                }
        }


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to