codeigniter-base-model
codeigniter-base-model copied to clipboard
Add support for model within a path
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