Welcome Guest, Not a member yet? Register   Sign In
Access to libraries in MY_Model
#3

(09-27-2015, 04:20 PM)InsiteFX Wrote: Get the CI super object.

In CI_Model we have magic method


Code:
/**
     * __get
     *
     * Allows models to access CI's loaded classes using the same
     * syntax as controllers.
     *
     * @param    string
     * @access private
     */
    function __get($key)
    {
        $CI =& get_instance();
        return $CI->$key;
    }

So in MY_Model in usual case u dont need get super object cause if u dont have property or method - it will be looking at super object.

That is the first note. Second - even if I get super object clearly $CI =& get_instance(); and load library $CI->load->library('my_lib');

when i try to run some method $CI->my_lib->some_method it throws error like i mention before

Call to a member function some_method on a non-object in... MY_Model and so on...
Reply


Messages In This Thread
Access to libraries in MY_Model - by scion - 09-27-2015, 01:36 PM
RE: Access to libraries in MY_Model - by InsiteFX - 09-27-2015, 04:20 PM
RE: Access to libraries in MY_Model - by scion - 09-28-2015, 02:49 AM
RE: Access to libraries in MY_Model - by InsiteFX - 09-28-2015, 11:01 AM
RE: Access to libraries in MY_Model - by scion - 09-29-2015, 04:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB