codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

Add support for model within a path

Open fzhan opened this issue 12 years ago • 0 comments

I've been trying to use base model for models under a certain path,

Eg., /models/cm/city_model.php ::

class City_model extends MY_Model { public $_table = 'temp_city'; public $primary_key = 'city_code'; public $belongs_to = array( 'province_model' => array( 'primary_key' => 'fk_province', 'model' => 'province_model') ); }

When I load the model in controller,

$this->load->model('cm/city_model'); print_r($this->city_model->with('province_model')->get(1));

will not work because the model name is actually not the same as defined in array

fzhan avatar Jul 06 '13 16:07 fzhan