Extending CI_Session_files_driver - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Extending CI_Session_files_driver (/showthread.php?tid=1615) |
Extending CI_Session_files_driver - CiUser - 03-25-2015 Hello, I'd need to extend CI_Session_files_driver class in order to add my own method. Example: PHP Code: class MY_Session_files_driver extends CI_Session_files_driver The extended driver is loaded correctly but the problem is that I can't access to the new method get_data(). PHP Code: Fatal error: Call to undefined method CI_Session::get_data() PHP Code: $this->session Do you know any way to extend the driver adding new methods? RE: Extending CI_Session_files_driver - Narf - 03-26-2015 You need to extend CI_Session, not CI_Session_files_driver. RE: Extending CI_Session_files_driver - CiUser - 03-26-2015 But, CI_Session is abstract and if I extend from this I'd need to implement all its abstract method. This is not my aim RE: Extending CI_Session_files_driver - mwhitney - 03-26-2015 CI_Session_driver is abstract. CI_Session is not. RE: Extending CI_Session_files_driver - CiUser - 03-26-2015 Cool, will try! RE: Extending CI_Session_files_driver - CiUser - 03-28-2015 I could resolve the problem. I created a class at /application/libraries/Session/MY_Session.php extendig from CI_Session and added my own methods on it and works fine. Thanks all for your help! |