hi i would like to make a check in my memberships model so that before
a save there will be a check to eliminate duplicate entries.

i have managed to do this using the following code in the membership
model:

        function beforeSave() {
                $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;
        }

however i would like to know if there is a neater way to do this thanks


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