table is unique. To do this I have added a custom validation
method. The code boils down to this:
[code]
if ($this->findCount("$fieldName = '$fieldValue'", -1) > 0) {
return false;
} else {
return true;
}
[/code]
While this works fine on new records, when I edit a record and try to
save it it fails because (obviously) the record already exists so the
uniqueness test fails.
The isUnique rule doesn't seem to work in all cases - seemingly in any
case.
Is there a way I can determine whether I am in update or insert 'mode'
in the model? Or perhaps someone can suggest another answer?
Rick
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment