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
1 changed files with 6 additions and 9 deletions

View File

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