CodeIgniter Forums

Full Version: why might some models autoload and others not.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]dcallan[/eluser]
Hey folks,
Quick question, I'm trying to auto load my models to keep my source a tidy as possible. It's working well, however I notice that my product, customer and email models are not autoloading from within certain other models.

$autoload['model'] = array('Email_bll','Category_bll','Favourites_bll','Product_bll','Basket_bll','Customer_bll','Order_bll','Invoice_bll','CreditNote_bll','User_bll');

The above is my autoload file and the models in question are autoloading from within the context of some other models but not all, so I have direct access in most of my code but every now and then I need to do something like:

//to use modelX inside modelY we load X via main CI object
$CI =& get_instance(); $CI->load->model('Customer_bll');
$customerSettings = $CI->Customer_bll->getCustomerSettings($customerID);

I access a method in a model from within another model. Has anyone any idea why this might be happening... Its' not really a show stopper as such, but I;ve a feeling I'll be using CI for a long time so it would be good to figure it out.

cheers.
dave.