Welcome Guest, Not a member yet? Register   Sign In
Can't extend MY_Model
#1

[eluser]coldscooter[/eluser]
I have created a MY_Model and I'm trying to extend my other models through it.

I keep getting fatal error MY_Model not found.

Where should I be putting the file? I've tried /config, /models, /libraries but it's still not finding it.

#2

[eluser]CroNiX[/eluser]
extensions to CI Core classes go in ... /application/core. You also shouldn't be loading MY_Model directly, which I assume you are or you wouldn't have gotten that error message. It will get loaded automatically whenever one of your models extends MY_Model.

/application/core/MY_Model.php

Code:
class MY_Model extends CI_Model {

}

/application/models/some_model.php

Code:
class Some_model extends MY_Model {

}

Code:
$this->load->model('some_model');

Never:
Code:
$this->load->model('MY_Model');
#3

[eluser]coldscooter[/eluser]
Hmmmm, it's still not working for me. I am using the DataMapper ORM library, so I wonder if this is causing the problem?
#4

[eluser]CroNiX[/eluser]
Haven't used that so can't really comment.




Theme © iAndrew 2016 - Forum software by © MyBB