My example does not compare field1 and field2 for uniqueness against
each other, it compares field1 and field2 against the database. When
creating a new record, it will check that the combination of
field1+field2 doesn't already exist in the database. When updating a
record it will check that the combination of field1+field2 doesn't
exist in the database unless the primary key of the submitted data
matches the primary key of the record in the database.

On Apr 22, 3:02 pm, John Andersen <j.andersen...@gmail.com> wrote:
> Thanks Euromark,
>
> I actually don't think that PHP code is the correct solution to this
> check :) I think that the correct solution is to let the database
> handle the unique check. The model will then be passed back the error
> and will take action on it (by the code we write). Probably there
> should be a translation of the error codes in between the database and
> the model (datasource?).
>
> The code that Andy D. (sample) and you posted will, as far as I
> understand, only handle the case of ensuring uniqueness in the
> submitted data, not in both the submitted data and the existing data
> in the table. Correct me if I am wrong :)
>
> Enjoy,
>    John
>
> On Apr 22, 6:08 pm, euromark <dereurom...@googlemail.com> wrote:
> [snipped code from euromark]
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to