Jesse Erlbaum wrote: >>You could also just punt and push this out to the >>controller. (Not very "pure" but simple to implement.) > > > This is exactly what I had in mind. (Perhaps you can explain what you mean > by "not very pure".)
Only that ideally you would want to keep this kind of knowledge just in the model objects, so that it is only expressed in one place. The controller shouldn't have to know that the "email" property of the Person model object needs to be a valid e-mail address; it should only be responsible for reading that in with $r->args() or something and passing it to the Person object, which knows how to check if its arguments are valid. However, I found it to be a real pain to code it that way and try to give nice error messages, which is why I now think that the simplicity of using standard form validation techniques makes up for the redundancy in most cases. - Perrin