Welcome Guest, Not a member yet? Register   Sign In
Extending CI_Model causing $this->load->model() to create an unnecessary MY_Model object instance
#11

[eluser]danmontgomery[/eluser]
This is intended behavior... When you load a model CI checks to see if the base model class has been loaded first. Loader.php, line 189.

Code:
if ( ! class_exists('CI_Model'))
{
    load_class('Model', 'core');
}

require_once($mod_path.'models/'.$path.$model.EXT);
#12

[eluser]wiredesignz[/eluser]
This is a bug. It exists in CI Core also.

If you check the core/Common.php file, load_class() method, you will see that a Model object is actually instantiated (line 166) when the only requirement is to load the CI_Model class and it's MY_Model extension if it exists.

The Model is a core class that should not be instantiated.




Theme © iAndrew 2016 - Forum software by © MyBB