Welcome Guest, Not a member yet? Register   Sign In
problem with custom controller constructor

(05-29-2021, 12:25 PM)includebeer Wrote: Don't use a constructor. Override initController(), don't forget to call parent::initController(), and then do what you need to do.
But, a better approach, would be to create a filter and do your redirect in it.

So I've been struggling with the "purpose" of initController and have resorted to using a standard constructor for all controllers extended off baseController (I'm migrating from CI3 you see).

Using a constructor is working for me, but my preference is to follow the "correct/recommended/designed" pattern. The problem I have is that you can't just call parent::initController() you have to provide the request, response and logger params.

I've not been able to find any code examples where parent::initController() is used.

Messages In This Thread
RE: problem with custom controller constructor - by paulkd - 05-29-2021, 11:39 PM

Theme © iAndrew 2016 - Forum software by © MyBB