문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top