[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?