fatnjazzy
fatnjazzy

Reputation: 6152

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

Upvotes: 1

Views: 3789

Answers (1)

Ross
Ross

Reputation: 17967

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

Upvotes: 2

Related Questions