Welcome Guest, Not a member yet? Register   Sign In
Problem sending post data to model for insert/update
#7

[eluser]medvind[/eluser]
[quote author="Colin Williams" date="1240129535"]"Getting individual pieces of post data from a form submit" is probably the wrong way to go about it. That puts too much weight on the controller to understand the data. You should be able to toss the whole $_POST array at the model, and the model should weed out any unnecessary properties.[/quote]

I have a model named Db_table and for each database table, I have models that extend it. As I see it, the processing of post data could be done in either of these two parts:

1. The controller, before passing it to the model
2. The model that corresponds to the appropriate database table, before passing it to the Db_table method for inserting data.

Bonus alternative: 3. I could choose not to process the data, and let Db_table try to tuck it in and see if it fits (i.e. if the $_POST array contains the appropriate number of fields and values)

So 2 is the way to go? Just to make it very clear for us MVC newbies Smile


Messages In This Thread
Problem sending post data to model for insert/update - by El Forum - 04-18-2009, 11:03 AM
Problem sending post data to model for insert/update - by El Forum - 04-18-2009, 07:58 PM
Problem sending post data to model for insert/update - by El Forum - 04-18-2009, 08:35 PM
Problem sending post data to model for insert/update - by El Forum - 04-18-2009, 09:25 PM
Problem sending post data to model for insert/update - by El Forum - 04-19-2009, 07:07 AM
Problem sending post data to model for insert/update - by El Forum - 04-20-2009, 08:29 AM
Problem sending post data to model for insert/update - by El Forum - 08-12-2009, 07:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB