I am working on a Codeigniter project and I have seen accessing the controller from the model. I am wondering if $this->controller is the same or different as using $CI =& get_instance(). I am assuming no, but I am more familiar with the standard returning data from a function than this way. I have not seen Codeigniter examples doing this, so I don't think this is a suggested way of accessing the controller, but more of a hack:
class my_model extends CI_Model
{
    public function __construct()
    {
        $this->errors = array();
        parent::__construct();
        $this->controller = get_instance();
    }
    public function somefunc()
    {
        // Accessing controller 
        $this->controller->session->set_userdata('foo', 'bar');
        $this->controller->data = "fubar";
    }
}
 
    