I encountered this problem several times with some batch imports or
multiple form boxes saved together.

You have a validation rule "isUnique" for the title.
If you validate all your - lets say 15 - records, they are OK, even if
two of them have the same name.
Thats because the validation can only compare the 15 records to the
current db content, not to each other.

In some cases you could probably just compare the new values and find
out if there are more than 2 of the same title.
But with some beforeValidation or beforeSave or even behaviors this is
not as easy anymore.

Did anyone find a solution to this problem?
I was thinking:
Creating "virtual records" in a special "isUnique" validation rule and
not only checking on "isUnique" in the DB but also comparing the value
to all the previously checked ones.

If you don't do it this way, some of your records will just be omitted
because the validation fails for them, although saveAll() with
validate=>first returned true in the first place...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to