Load Model in HMVC
I am trying to load a model within the same module from a controller.
$this->load->model('pendingAccountModel');
but the model could not be loaded.
the module dir is accounts.
the model file path is: app/modules/accounts/models/pendingAccountModel.php the model decleration is:class PendingAccountModel extends Model {
function __construct(){
parent::__construct();
}
}
this is the controller who loads the model:
class PendingAccount extends MX_Controller {
function __construct(){
parent::__construct();
}
function register($data_arr)
{
$this->load->model('pendingAccountModel');
}
开发者_如何学编程
}
CI 1.72 with latest hmvc Thanks
had a quick read through the HMVC docs ~
$this->load->model('pendingAccountModel');
the docs suggest that you should include the module name in the include path
so try (perhaps) $this->load->model('accounts/pendingAccountModel');
also note your "PendingAccount" controller needs to be in:
app/modules/accounts/controllers/PendingAccount.php
精彩评论