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

[eluser]autefrum[/eluser]
I too have this problem.

I have code:
Code:
foreach($id_array as $id) {
   $model_name="model_".$id;
   $this->load->model($model_name,"model_n");  
   $ret_val[$id]=$this->model_n->get_something();
}

So I tried to overcome using:
Code:
unset($this->model_n);
unset($this->load->_ci_models[array_search('model_n',$this->load->_ci_models)]);

but I get an error:
Cannot access protected property CI_Loader::$_ci_models in {local path}\application\models\account_model.php

I don't want to stuff around with the core and change the _ci_models to be a public property, but I support I could....

And I can't use this:
Code:
$this->load->model('class_1', 'my_model');

$this->my_model->some_class_1_function();

$this->load->model('class_2', 'my_model_2');

$this->my_model = $this->my_model_2;

$this->my_model->some_class_2_function();

As I don't want to hard code the 2 in
Code:
$this->my_model = $this->my_model_2;

So I am a little stuck.....

Has anyone overcome this in the last few years?


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