Validation+Filtering |
[eluser]Colin Williams[/eluser]
I touched on this in my recent screencast, where I say I go back and forth about where the form should be defined. The ultimate goal is to have it defined in only one place. My argument for the Controller is one of ergonomics (if that makes sense) because I like to be able to tweak the entire form submission, validation, response without having to bounce between the Controller and the model. This is the same reason I don't like putting validation rules and fields in config files. There are good arguments to be made for the model, of course, but having it in the controller just works for me (this coming from doing it all ways mentioned before)
[eluser]RESPECT[/eluser]
try to follow what colin said, keep things divided up as it was 'intended' to be with the term MVC (model, view, controller). I know what I'm about to say now goes against my previous thoughts (please dont colin ) but it would be better to have those validation rules tied into your controller as it allows your application to be more agile, rather then having the rules set in the model. If you have base validation rules and functions, just setup another controller, then make all of your other controllers extend it. ex. Random controller(magic happens with the extend part) Code: <?php Validation Controller Code: <?php Your way is good but try not to put that sorta stuff in the model...though error checking like this: Code: function view_all_from($table) { Hope this helps, Respect
[eluser]Colin Williams[/eluser]
Quote:I know what I’m about to say now goes against my previous thoughts (please dont colin) Haha.. no big deal. I change my mind all the time about this stuff. |
Welcome Guest, Not a member yet? Register Sign In |