开发者

cakephp inset violating unique constraint

开发者 https://www.devze.com 2023-03-06 05:59 出处:网络
using cakephp on email column in the db i have unique constraint, how can check before inserting record开发者_高级运维ing that email may be duplicate or after inserting detect and print error.Check ou

using cakephp on email column in the db i have unique constraint, how can check before inserting record开发者_高级运维ing that email may be duplicate or after inserting detect and print error.


Check out the Core Validation Rules. There's one for isUnique.


Found another good example at http://www.davidtan.org/cakephp-tutorial-how-to-insert-records-into-table-with-unique-index-made-up-of-2-or-more-fields/

0

精彩评论

暂无评论...
验证码 换一张
取 消