public function execute($controllerAction = null, $args = [])
{
$this->_loadListeners();
$this->_action = $controllerAction ?: $this->_action;
$action = $this->_action;
if (empty($args)) {
$args = $this->_request->params['pass'];
}
try {
$event = $this->trigger('beforeHandle', $this->getSubject(compact('args', 'action')));
$response = $this->action($event->subject->action)->handle($event->subject->args);
if ($response instanceof Response) {
return $response;
}
} catch (Exception $e) {
if (isset($e->response)) {
return $e->response;
}
throw $e;
}
$view = null;
$crudAction = $this->action($action);
if (method_exists($crudAction, 'view')) {
$view = $crudAction->view();
}
return $this->_controller->response = $this->_controller->render($view);
}