Welcome Guest, Not a member yet? Register   Sign In
My_Model don't auto Load by Core/Loader
#5

You shouldn't need the MY_Model class to be instantiated in order for things to work properly. Whatever class extends MY_Model should simply call the parent::__construct() method in its constructor (if the constructor is defined) just as you have done in your MY_Model constructor.

Further, you shouldn't need to call get_instance() in MY_Model, since CI_Model defines a __get() method which does this for you. If you removed the definition of the $commun property from MY_Model, calling $this->commun = $this->load->database('commun', true, true); should do the same thing that you seem to be trying to do with the rest of the code in your constructor.
Reply


Messages In This Thread
My_Model don't auto Load by Core/Loader - by Pad - 01-26-2016, 11:53 PM
RE: My_Model don't auto Load by Core/Loader - by mwhitney - 01-27-2016, 03:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB