Welcome Guest, Not a member yet? Register   Sign In
Validation Class in Controller or Model?
#1

[eluser]chrisco23[/eluser]
Recently I have been refactoring my first CI project which I began 3 years ago.

At the time I did my form validation in my models. I was about to transfer the validation to the controllers this time around but then I started second guessing myself.

I can see an argument that the validation is most closely tied to the form and so it belongs in the controllers, and then I can see the argument that the data is most closely tied to the data models.

I have one rather complex form in particular where the flow will be:
Do some validation, then do some queries, then do some more validation, more queries, etc.

What have others found to be most practical and is it the same as what is the "theoretical" best practice?

I tried Googling around about form validation in MVC and mostly I found that Rails and Cake seem to validate in models.


Thanks,
Chris


Messages In This Thread
Validation Class in Controller or Model? - by El Forum - 10-08-2008, 03:42 PM
Validation Class in Controller or Model? - by El Forum - 10-08-2008, 04:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB