add json encode for controller

This commit is contained in:
Taras Machyshyn
2013-12-19 10:41:02 +02:00
parent 0ee6996a94
commit 2f455cc654
+6 -3
View File
@@ -70,16 +70,19 @@ class ControllerManager
if (!method_exists($controller, $actionMethodName)) {
throw new NotFound("Action '$actionMethodName' does not exist in controller '$controller'");
}
$result = $controller->$actionMethodName($params, $data);
$afterMethodName = 'after' . $actionNameUcfirst;
if (method_exists($controller, $afterMethodName)) {
$controller->$afterMethodName($params, $data);
}
return $result;
if (is_array($result) || is_bool($result)) {
return \Espo\Core\Utils\Json::encode($result);
}
return $result;
}
}