Welcome Guest, Not a member yet? Register   Sign In
passing data to model
#5

[eluser]JayTee[/eluser]
[quote author="TheFuzzy0ne" date="1236154855"]IMHO, data should be passed to the model pre-validated and sanitised, so it's ready to go straight into the database, or be handled by the model. None of my models access the post array, as I believe that's what the controller is for. The controller processes any input and decides what to do with it.

If there is a lot of code in my controller, I try to export it to methods either in the controller, or in a library. I'm sure some other people will disagree with me, however.[/quote]
Fuzzy is right on the money. As I've said in previous threads, I think that the model should be treated as if it's on a separate server. In effect, the model shouldn't have any awareness of anything other than database interaction.

As Fuzzy mentioned - I think it's a great idea to have some private functions in your controller to build/scrub your data before passing it to model.


Messages In This Thread
passing data to model - by El Forum - 03-03-2009, 08:14 PM
passing data to model - by El Forum - 03-03-2009, 08:20 PM
passing data to model - by El Forum - 03-03-2009, 08:20 PM
passing data to model - by El Forum - 03-03-2009, 08:30 PM
passing data to model - by El Forum - 03-03-2009, 08:37 PM
passing data to model - by El Forum - 03-03-2009, 08:52 PM
passing data to model - by El Forum - 03-03-2009, 09:05 PM
passing data to model - by El Forum - 03-03-2009, 09:09 PM
passing data to model - by El Forum - 03-03-2009, 09:10 PM
passing data to model - by El Forum - 03-03-2009, 09:15 PM
passing data to model - by El Forum - 03-03-2009, 09:32 PM
passing data to model - by El Forum - 03-03-2009, 09:44 PM
passing data to model - by El Forum - 03-03-2009, 09:48 PM
passing data to model - by El Forum - 03-03-2009, 09:51 PM
passing data to model - by El Forum - 03-03-2009, 09:55 PM
passing data to model - by El Forum - 03-03-2009, 10:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB