(06-01-2015, 09:02 AM)mwhitney Wrote: However, if you were using that file as a controller somewhere else on your site, you probably already broke it by removing the base constructor.
You are right, I went too fast, it doesn't work
(06-01-2015, 09:02 AM)mwhitney Wrote: A class extending CI_Controller can't load another class which also extends CI_Controller. You will probably need to replace the second controller with a library.
It worked with CI2, in my opinion it should be noted in CI3 the upgrade guide.
I don't know how to transform this class to a library. I changed the Plan_Events class to not extend the CI_Controller but assigning a CI instance because I need to use the CI models, now it seems to work:
PHP Code:
class Plan_Events {
public function __construct()
{
$this->CI =& get_instance();
}
public function beforeInsert($data)
{
$this->CI->load->model('example_model');
$this->CI->example_model->scheduler_insert($data);
}
...
}
Please tell me if it isn't a good practice. Note that I'm using Plan_Events to integrate the DHTMLX library like this:
PHP Code:
class Controller_A extends CI_Controller
{
...
public function get_events()
{
...
require_once("assets/dhtmlx/dhtmlxConnector/codebase/scheduler_connector.php");
require_once("Plan_Events.php");
$conn = new SchedulerConnector($this->db, "PHPCI");
$conn->event->attach(new Plan_Events()); // Update/Delete/...
...
}
Thx for the support