diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 5556b4cd4..85ad0949e 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -307,7 +307,7 @@ class Web extends EmbeddedWeb $this ->getLoader() ->registerNamespace( - 'Icinga\\Controllers', + 'Icinga\\' . Dispatcher::CONTROLLER_NAMESPACE, $this->getApplicationDir('controllers') ) ->registerNamespace( diff --git a/library/Icinga/Web/Controller/Dispatcher.php b/library/Icinga/Web/Controller/Dispatcher.php index efa0e02b2..6e1f32e02 100644 --- a/library/Icinga/Web/Controller/Dispatcher.php +++ b/library/Icinga/Web/Controller/Dispatcher.php @@ -18,6 +18,13 @@ use Zend_Controller_Response_Abstract; */ class Dispatcher extends Zend_Controller_Dispatcher_Standard { + /** + * Controller namespace + * + * @var string + */ + const CONTROLLER_NAMESPACE = 'Controller'; + /** * Dispatch request to a controller and action * @@ -38,9 +45,10 @@ class Dispatcher extends Zend_Controller_Dispatcher_Standard } $controllerName = ucfirst($controllerName) . 'Controller'; if ($this->_defaultModule === $this->_curModule) { - $controllerClass = 'Icinga\\Controllers\\' . $controllerName; + $controllerClass = 'Icinga\\' . self::CONTROLLER_NAMESPACE . '\\' . $controllerName; } else { - $controllerClass = 'Icinga\\Module\\' . $this->_curModule . '\\Controllers\\' . $controllerName; + $controllerClass = 'Icinga\\Module\\' . $this->_curModule . '\\' . self::CONTROLLER_NAMESPACE . '\\' + . $controllerName; } if (! class_exists($controllerClass)) { parent::dispatch($request, $response);