Jump to content

How do I access controller in overriding Hook exec?


Wildrain

Recommended Posts

I'm overriding Hook.php exec() function and I would like to get the controller by using Dispatcher::getInstance()->getController() but a fatal error is thrown

It's my understanding that when I call the above function the spl_autoloader loads and instantiates the Dispatcher class if it hasn't already been loaded, so I should be able to getController at that point.

 

I understand that the controller may not be defined at every call to Hook::exec and if so, then the getController() returns false or whatever else it returns but it shouldn't throw a fatal error.

 

I can see that the original exec function in the HookCore makes use of Dispatcher::getInstance()->getController() so I'm not sure what else I need to run or check to make sure I can use the Dispatcher.

 

Thank you for any help or pointers you may be able to provide

Edited by Wildrain (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...