Welcome Guest, Not a member yet? Register   Sign In
Clarification about MY_Controller and relative inheritances
#15

(04-18-2017, 01:57 AM)Martin7483 Wrote:
(04-17-2017, 04:37 PM)daveĀ friend Wrote: But, if MY_Controller does not mess with any CI_Controller properties (and it only has one - private static $instance; so there is nothing to mess with) then technically he does not need to explicitly call the base class constructor. PHP will do it anyway.

That is true, but in that case the MY_Controller class may not have a __construct() method. If it does have a __construct() method you MUST call the parent::_construct manually.

So the question is:
Does @gbwebapps have an empty constructor in his MY_Controller class?

The point I failed to make is that however he has defined MY_Controller it must be OK. If it was not then his call to $this->load->model('Auth_Model'); in Dashboard::index() would produce the error: "Undefined property: Dashboard::$load".

But he says it works. If Dashboard has access to $load then CI_Controller::__construct() did execute.

Still, it would be nice to see the code for MY_Controller and to see the error message he mentions.
Reply


Messages In This Thread
RE: Clarification about MY_Controller and relative inheritances - by dave friend - 04-19-2017, 07:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB