Welcome Guest, Not a member yet? Register   Sign In
[solved] Multiple instances of a model
#1

(This post was last modified: 03-22-2016, 05:30 AM by Fred9176.)

Hi,

I would like to know if it was possible to have multiple instances of the same model in a controller.

For exemple, I'dlike to do something like that : 

$objects = array();

for($i = 1;$i < 10; $i++){
       $objects[] = new Objectmodel($i);
}

The only way I found to do that is to include the corresponding model file in the controller php file and remove the "extends My_Model".

Is there a better way to do that using a more CI compliant manner ?

Thank you for your help,

Fred
Reply


Messages In This Thread
[solved] Multiple instances of a model - by Fred9176 - 03-21-2016, 08:24 AM
RE: Multiple instances of a model - by Narf - 03-21-2016, 08:49 AM
RE: Multiple instances of a model - by Fred9176 - 03-21-2016, 09:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB