Using $_POST at the model

#15
[eluser]Edmundas Kondrašovas[/eluser]
[quote author="bigtony" date="1250254712"]To give an example, in one application I have a function in a model that will add details about a building, but in some cases this data comes from a form and in other cases it can be generated programatically. Had I used $this->input or $_POST it would not have been possible to call it with the programmatically generated data without duplicating the function.

It's only a small amount of extra work to pass post data into the model rather than use it directly, but worth it in the long run.[/quote]

It depends on what you're trying to accomplish. If you want your model to not only gather data from a form, but from elsewhere as well, then it's definitely not good practise to process input values from the model. On the other hand, if you know you're going to use the model just for the form, then it's not all that bad fetching input values from the model.

Maybe it's not the smartest idea, but I use both variants depending on the situation.


Messages In This Thread
Using $_POST at the model - by El Forum - 08-12-2009, 06:05 AM
Using $_POST at the model - by El Forum - 08-12-2009, 06:14 AM
Using $_POST at the model - by El Forum - 08-12-2009, 11:04 AM
Using $_POST at the model - by El Forum - 08-12-2009, 11:27 AM
Using $_POST at the model - by El Forum - 08-12-2009, 12:32 PM
Using $_POST at the model - by El Forum - 08-12-2009, 01:54 PM
Using $_POST at the model - by El Forum - 08-12-2009, 03:01 PM
Using $_POST at the model - by El Forum - 08-12-2009, 03:38 PM
Using $_POST at the model - by El Forum - 08-13-2009, 06:41 AM
Using $_POST at the model - by El Forum - 08-13-2009, 10:32 AM
Using $_POST at the model - by El Forum - 08-14-2009, 12:47 AM
Using $_POST at the model - by El Forum - 08-14-2009, 01:02 AM
Using $_POST at the model - by El Forum - 08-14-2009, 01:58 AM
Using $_POST at the model - by El Forum - 08-14-2009, 02:17 AM
Using $_POST at the model - by El Forum - 08-14-2009, 02:21 AM
Using $_POST at the model - by El Forum - 08-14-2009, 02:37 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.