Welcome Guest, Not a member yet? Register   Sign In
Is it possible to UNLOAD a model?
#3

[eluser]Pygon[/eluser]
You might re-consider how your dynamic code generation works, or consider using a variable reference, ie:
Code:
$this->load->module('class_1','my_model1',TRUE);
$myclass =& $this->my_model1;
$myclass->doSomething(); //same as $this->my_model1->doSomething()
$this->load->module('class_2','my_model2',TRUE);
unset($myclass);
$myclass =& $this->my_model2;
$myclass->doSomething(); //same as $this->my_model2->doSomething()

Another alternative would similar to the above:
Code:
$i = 1;
$this->load->module('class_'.$i,'my_model'.$i,TRUE);
$mymodule = 'this->my_model'.$i;
${$mymodule}->doSomething(); // same as $this->my_model1->doSomething()
$i++;
$this->load->module('class_'.$i,'my_model'.$i,TRUE);
$mymodule = 'this->my_model'.$i;
${$mymodule}->doSomething(); // same as $this->my_model2->doSomething()


Messages In This Thread
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 10:38 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 11:51 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 12:44 PM
Is it possible to UNLOAD a model? - by El Forum - 11-17-2007, 03:59 AM
Is it possible to UNLOAD a model? - by El Forum - 04-01-2009, 10:01 AM
Is it possible to UNLOAD a model? - by El Forum - 10-17-2009, 11:02 PM
Is it possible to UNLOAD a model? - by El Forum - 10-18-2009, 07:17 AM
Is it possible to UNLOAD a model? - by El Forum - 02-17-2012, 06:42 PM
Is it possible to UNLOAD a model? - by El Forum - 02-18-2012, 02:53 AM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 12:12 PM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 01:00 PM
Is it possible to UNLOAD a model? - by El Forum - 07-12-2013, 07:08 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:21 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB