I'm pretty new to cake, but while reading through the manual, I picked
up on something odd and just wanted to see how others felt about this.
For basic regular expression validation, that information is placed
within the model. Which makes sense, the controller really doesn't care
about validation, it just wants to hand the information to the model
and see if the data is valid or not. This sounds perfect to me until we
reach the section about custom validation.

Let's say we have a few fields that work fine with basic regexp checks,
so those go in the model. But according to the manual, if we have any
custom validation (like checking if a username is already taken), that
goes in a controller action... something about that doesn't seem right.
Now we have part of our validation in the model and the other part in
the controller. If a model is used by multiple controllers, then we
have to copy that validation across the controllers? So much for DRY.

I could be understanding this wrong, but that's what I'm getting out of
the manual. Is there any better way to do this? I would think something
like validateFieldName() functions within the model that are called
automagically when the model saves/validates would make more sense for
custom validation, but I don't see that in the manual.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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