Welcome Guest, Not a member yet? Register   Sign In
Model Example is Bad in User Guide
#12

[eluser]Madoc[/eluser]
Apologies to be a bit off topic but for the sake of clarification as I am a CI beginner:

[quote author="InsiteFX" date="1297159850"]This is why use use a library and you set all of your input post data in the library then you pass the $data array to your model!
[/quote]

By library do you mean the controller ?

[quote author="InsiteFX" date="1297159850"]then you pass the $data array to your model!
[/quote]

You pass your array to the model function rather than the model right ?


[quote author="MNG GHOST" date="1301402223"]
function GetMenus($parrams = array(), $id = 0)
{
// here we can manipulate what is comming from our user interfaces, so we can use $parrams array or our single parameter id.

//Its not needed to use directly input->post();
//Since the idea behind the model is just interacting with DB and returning to any where its called.
}
[/quote]

Am I wrong in saying that you generate your array on the controller (using the input->post()) ?

And for my information: why use an array rather than individual parameters for each information intended to be used on the model ? is it better practice ? Isn't it more risky due to the flexibility of the array (no size restriction on the array passed to the function) ?

Code:
function GetMenus($param1, $param2, $param3, $param4, $id = 0)
{
   //forces to have the required data before doing anything on your function
}


Messages In This Thread
Model Example is Bad in User Guide - by El Forum - 07-27-2010, 09:13 PM
Model Example is Bad in User Guide - by El Forum - 11-18-2010, 07:37 PM
Model Example is Bad in User Guide - by El Forum - 11-22-2010, 11:38 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 03:44 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 07:48 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 07:55 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 08:38 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 08:52 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 09:10 PM
Model Example is Bad in User Guide - by El Forum - 02-07-2011, 10:10 PM
Model Example is Bad in User Guide - by El Forum - 03-29-2011, 01:37 AM
Model Example is Bad in User Guide - by El Forum - 03-29-2011, 04:41 PM
Model Example is Bad in User Guide - by El Forum - 03-29-2011, 07:40 PM
Model Example is Bad in User Guide - by El Forum - 03-29-2011, 10:16 PM
Model Example is Bad in User Guide - by El Forum - 03-30-2011, 03:02 AM
Model Example is Bad in User Guide - by El Forum - 03-30-2011, 07:01 AM
Model Example is Bad in User Guide - by El Forum - 03-30-2011, 07:16 AM
Model Example is Bad in User Guide - by El Forum - 03-30-2011, 10:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB