Welcome Guest, Not a member yet? Register   Sign In
extend core class CI_Session problem
#10

[eluser]Unknown[/eluser]
Sorry for the major bump but.

Greg said that the MY_class should be in core not libraries. This is incorrect as far as my testing goes.

My case:

Version: 2.0

Extending CI_Session

Location: application/libraries/MY_Session.php
Definition:
Code:
class MY_Session extends CI_Session {

    public function __construct($params = array())
    {
        var_dump('yay!');
        die();
    }
}

Effectively replaces the constructor of CI_Session

Locating the same file under application/core fails to do so.


PS
I am also trying to replace CI_Model but haven't been successful at it. I will make a post about it if search on the forum results in no help.

-Edit-
only applicable to CI 2.0

CI_Session is located in system/libraries, hence MY_Session makes sense to be in application/libraries.

Made MY_Model work by locating the file in application/core. CI_Model resides in system/core so it makes sense to be in application/core.

The only other change you need to do is change your models (in application/models) to extend MY_Model not CI_Model. And if your model construct functions still contain the following:

Code:
parent::CI_Model();

change it to:

Code:
parent::__construct();


Location: application/core/MY_Model.php
Definition:

Code:
class MY_Model extends CI_Model
{
    function __construct()
    {
        var_dump('yay2!');
        die();
    }
}


Messages In This Thread
extend core class CI_Session problem - by El Forum - 10-22-2008, 12:55 PM
extend core class CI_Session problem - by El Forum - 10-22-2008, 01:16 PM
extend core class CI_Session problem - by El Forum - 10-22-2008, 02:04 PM
extend core class CI_Session problem - by El Forum - 10-22-2008, 02:15 PM
extend core class CI_Session problem - by El Forum - 10-22-2008, 02:56 PM
extend core class CI_Session problem - by El Forum - 11-11-2008, 05:09 AM
extend core class CI_Session problem - by El Forum - 11-11-2008, 08:56 AM
extend core class CI_Session problem - by El Forum - 12-22-2008, 03:48 PM
extend core class CI_Session problem - by El Forum - 12-27-2010, 07:47 PM
extend core class CI_Session problem - by El Forum - 02-17-2011, 11:29 AM
extend core class CI_Session problem - by El Forum - 02-17-2011, 04:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB