Open tonyjdev opened 11 years ago
This is HMVC not MVC :)
I tested and its worked for me.
// modules/language_module/models/language_model.php
class Language_model extends MY_Model
{
protected $_table = 'language';
protected $primary_key = 'language_id';
public $belongs_to = array(
'user' => array(
'model' => 'demo_module/user_model',
'primary_key' => 'language_id'
)
);
public function languages( )
{
return $this->with('user')->get_all();
}
}
// modules/demo_module/models/user_model.php
class User_model extends MY_Model
{
protected $primary_key = 'id';
function __construct()
{
// Call the Model constructor
parent::__construct();
}
}
And in some controller I colling this like so:
$this->load->model( 'language_module/language_model' );
$aData['languages'] = $this->language_model->languages();
$this->load->view( 'language_module/menu_view', $aData );
p.s. I used Modified HMVC CodeIgniter for real HMVC and file and directories structure is the same as yours.
I have a MVC architecture, directories are like this:
So, in the "module_one/models/one_model.php":
show this error: Unable to locate the model you have specified: two_model
If I change the line:
by
get this error:
¿How can I fix this and load the model on MVC architecture?
Thanks :)