diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index 251d2e56e..d83e7a450 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -184,7 +184,12 @@ class Dispatcher throw new PathException($path); } - $this->controllers[$controller] = new $controller($this->app); + // If module controller use module manager for initialization + if(count($split = explode('\\', $controller)) === 4) { + $this->controllers[$controller] = $this->app->moduleManager->get($split[2]); + } else { + $this->controllers[$controller] = new $controller($this->app); + } } return $this->controllers[$controller];