Use Zend_Cotroller_Dispatcher_Standard::getActionMethod() in the Dispatcher

refs #5786
This commit is contained in:
Eric Lippmann 2015-08-17 13:34:47 +02:00
parent 1e1d4531c6
commit e26a7fd4d1

View File

@ -4,7 +4,6 @@
namespace Icinga\Web\Controller; namespace Icinga\Web\Controller;
use Exception; use Exception;
use LogicException;
use Zend_Controller_Dispatcher_Standard; use Zend_Controller_Dispatcher_Standard;
use Zend_Controller_Request_Abstract; use Zend_Controller_Request_Abstract;
use Zend_Controller_Response_Abstract; use Zend_Controller_Response_Abstract;
@ -20,7 +19,9 @@ class Dispatcher extends Zend_Controller_Dispatcher_Standard
* Dispatch request to a controller and action * Dispatch request to a controller and action
* *
* @param Zend_Controller_Request_Abstract $request * @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $resposne * @param Zend_Controller_Response_Abstract $response
*
* @throws Exception If dispatching the request fails
*/ */
public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response) public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{ {
@ -41,11 +42,7 @@ class Dispatcher extends Zend_Controller_Dispatcher_Standard
return; return;
} }
$controller = new $controllerClass($request, $response, $this->getParams()); $controller = new $controllerClass($request, $response, $this->getParams());
$actionName = $request->getActionName(); $action = $this->getActionMethod($request);
if (! $actionName) {
throw new LogicException('Action name not found');
}
$actionName = $actionName . 'Action';
$request->setDispatched(true); $request->setDispatched(true);
// Buffer output by default // Buffer output by default
$disableOb = $this->getParam('disableOutputBuffering'); $disableOb = $this->getParam('disableOutputBuffering');
@ -54,7 +51,7 @@ class Dispatcher extends Zend_Controller_Dispatcher_Standard
ob_start(); ob_start();
} }
try { try {
$controller->dispatch($actionName); $controller->dispatch($action);
} catch (Exception $e) { } catch (Exception $e) {
// Clean output buffer on error // Clean output buffer on error
$curObLevel = ob_get_level(); $curObLevel = ob_get_level();