Welcome Guest, Not a member yet? Register   Sign In
Validation+Filtering
#8

[eluser]RESPECT[/eluser]
sorry, i meant that as more of a side thought...
I mean if you don't do the validation+filtering at the model level, ex. stripping out all html code and swapping in entities, you would need to write the validation out each time you make that model call in the controller and therefore you would not be using the DRY principle...

Saying you are doing this in the controller
Code:
$data = '<b>yum, html coding</b>';
$filtered_data = htmlentities($data);
$query = $this->random_model->insert($filtered_data);

You would save time by not repeating yourself to do mundane validation+filtering tasks by having that validation built into the insert() function in the model. Then you could simple do $this->random_model->insert($data); which will save you time, though you obviously would be doing more checks then just htmlentities. That's just an example.

Quote:Why would you need to validate it twice?

Im simply saying IF you have the validation setup as I mentioned above to save yourself from repeating code, and you find you don't need to strip out something that you previously have coded into the database call you would run into problems. I was just thinking out loud for a solution to it by stating you can redefine that call elsewhere, so it wouldn't be validated twice, just the validation that is being done to it would be changed.


Quote:And why then do you agree 100% with validating in the controller?
Well I agree with the validation of the controller because I found a better way (imo) to split up the model & controller. You would need a validation controller setup w/ a non-routed functions (underscored) to do the validation and communication with the model then just make all your other controllers extend it...make the calls to it when needed that way everything stays all separated and clean Smile


Sorry again if you dont understand what I mean, don't really know how i can make it much clearer then that.

Respect


Messages In This Thread
Validation+Filtering - by El Forum - 09-25-2008, 06:04 PM
Validation+Filtering - by El Forum - 09-25-2008, 06:32 PM
Validation+Filtering - by El Forum - 09-25-2008, 07:05 PM
Validation+Filtering - by El Forum - 09-25-2008, 10:13 PM
Validation+Filtering - by El Forum - 09-25-2008, 11:40 PM
Validation+Filtering - by El Forum - 09-26-2008, 10:10 PM
Validation+Filtering - by El Forum - 09-26-2008, 11:29 PM
Validation+Filtering - by El Forum - 09-27-2008, 03:22 PM
Validation+Filtering - by El Forum - 09-28-2008, 05:16 PM
Validation+Filtering - by El Forum - 09-29-2008, 02:35 PM
Validation+Filtering - by El Forum - 09-29-2008, 02:52 PM
Validation+Filtering - by El Forum - 09-29-2008, 09:46 PM
Validation+Filtering - by El Forum - 09-30-2008, 09:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB