Welcome Guest, Not a member yet? Register   Sign In
How to extend the Controller core class

(This post was last modified: 04-03-2020, 01:26 PM by never2ice.)

Thanks for the reply. It seems my question is only slightly related to this thread, but hopefully relevant enough to continue. So what I really would like to see is a simple example of how to properly extend the BaseController of CI4 with a child class that implements a constructor. Doesn't that child class constructor method need to call the initController method of BaseController? The CI4 documentation addresses extending the BaseController, but the child class does not have a __construct() function.

Extending the Controller

Is this a proper example?

class SomeController extends BaseController

    public function __construct()
        parent::initController(\Config\Services::request(), \Config\Services::response(), \Config\Services::logger());

        // other stuff needed in my constructor


Messages In This Thread
How to extend the Controller core class - by Edel - 07-22-2017, 03:35 PM
RE: How to extend the Controller core class - by never2ice - 04-03-2020, 12:14 PM

Theme © iAndrew 2016 - Forum software by © MyBB