Friday, November 5, 2010

Ensuring uniqueness on application level

Hey guys!

I'm having a little bit of trouble with validation on my models. That
is because I'm using isUnique on some fields, but I didn't defined the
fields as unique keys on the DB (I'm using MySQL). I can't make them
unique keys right now because I'm using soft deletion on these models.

The thing is that, sometimes the DB connection will break, and
isUnique won't return a valid value, making it possible for my users
to register things with the same name, which is causing a lot of
trouble for me. I was trying to think in a way to ensure that, even
when the DB fails, I get some sort of good value from isUnique, so the
user won't be able to register with a duplicated name...

Does anyone have any hints on how can I do this the best way possible?

Thanks!

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

No comments: