php - Codeigniter - autoloading models with aliases -


when manually load models in codeigniter can specify alias so:

$this->load->model("user_model","user"); //user alias user_model $this->user->getprofile(); //use alias refer actual model 

some of these models being extensively used in application , decided autoload them using autoload.php. know can load them so:

$autoload['model'] = array("user_model","another_model"); 

however referenced on aliases. want load them existing alias name current code not disturbed.

i guess can have code in autoloaded helper maybe:

$ci= &get_instance(); $ci->user = $ci->user_model; 

but wanted check is, can load model alias name while autoloading?

yes can create same alias in in autoload pass array try not possiable alias can create same alias auto loading time.

$autoload['model'] = array(array('users_model', 'users'), array('an_model', 'an'), 'other_model'); 

or try

$autoload['model'] = array(array('users_model', 'users', false));   

for more :- https://github.com/ellislab/codeigniter/issues/2117

http://ellislab.com/forums/viewthread/110977/#560168


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -