Several discussions were held regarding the location of user input validation:
Should checks be performed on form objects or in the model?
Where do you check? model, controller or view
These discussions were quite old, so I wanted to ask a question again to find out if anyone has any fresh input. If not, I apologize in advance.
If you came from the "Validation in Model" camp - does the model mean representing OOP data (for example, Active Record / Data Mapper) as "Entity" (to borrow DDD terminology) - in this case, I suppose, you want all classes models inherited general validation constraints. Or can these rules just be part of the Service in the Model - that is, the verification service? For example, could you consider Zend_Form and its verification classes for the Model part? The concept of a Domain Model is not limited to entities, so validation does not have to be limited to these objects.
It seems that you will need a lot of potentially redundant transfer of values ββand responses between forms and "Entities", and in some cases you will not be able to save data received from user input, or receive it from user input at all.
source share