[eluser]Rob Corley[/eluser]
I'm getting the following error:-
Code:
Fatal error: Call to undefined method Some_model::method()
method() is defined in my extension to CI_Model (MY_Model).
Some_model extends Version_model and Version_model extends MY_Model. I am autoloading Version_model and I can call methods that are defined in Version_model, but not one's defined in MY_model.
This doesn't happen if I inherit directly from MY_Model.
Here's the code to clarify my explanation;
Extension to CI_Model:-
Code:
class MY_Model extends CI_Model {
function __construct()
{
parent::__construct();
}
// --------------------------------------------------------------------
/**
* Method
*/
public function method() {
return true;
}
/* End of file MY_Model.php */
/* Location: ./application/libraries/MY_Model.php */
Version model which handles record versioning:-
Code:
class Version_model extends MY_Model {
function __construct()
{
parent::__construct();
# Some code here
}
// --------------------------------------------------------------------
/**
* Some Version Method
* @param none
* @return bool true
*
*/
private function version_method()
{
return TRUE;
}
}
/* End of file Version_model.php */
/* Location: ./application/models/version_model.php */
The model that extends Version_model and the one that is producing the error:-
Code:
class Some_model extends Version_model {
function __construct()
{
parent::__construct();
}
}
/* End of file Some_model.php */
/* Location: ./application/models/some_model.php */
To produce error:-
Code:
class Some_controller extends CI_Controller {
function __construct ()
{
parent::__construct();
# Load some stuff
$this->load->model('version_model');
$this->load->model('some_model');
}
/**
* Index page for this controller.
*/
public function index()
{
$this->some_model->method();
}
/* End of file some_controller.php */
/* Location: ./application/controllers/some_controller.php */
This produces the following error:-
Fatal error: Call to undefined method Some_model::method() in ...
Thanks in advance, I feel like I'm just missing something obvious...