public function handleAction($action, $actionParams)
    {
        $response = new b8\Http\Response\JsonResponse();
        try {
            $data = parent::handleAction($action, $actionParams);
            if (isset($data['responseCode'])) {
                $response->setResponseCode($data['responseCode']);
                unset($data['responseCode']);
            }
            $response->setContent($data);
        } catch (Exception $ex) {
            $response->setResponseCode(500);
            $response->setContent(array('status' => 'failed', 'error' => $ex->getMessage()));
        }
        return $response;
    }
public function handleAction($action, $actionParams)
    {
        $response = new b8\Http\Response\JsonResponse();
        try {
            $data = parent::handleAction($action, $actionParams);
            if (isset($data['responseCode'])) {
                $response->setResponseCode($data['responseCode']);
                unset($data['responseCode']);
            }
            $response->setContent($data);
        } catch (Exception $ex) {
            $response->setResponseCode(500);
            $response->setContent(array('status' => 'failed', 'error' => $ex->getMessage()));
        }
        return $response;
    }
public function handleAction ( $ action , $ actionParams ) { $ response = new b8 \ Http \ Response \ JsonResponse ( ) ; try { $ data = parent :: handleAction ( $ action , $ actionParams ) ; if ( isset ( $ data [ 'responseCode' ] ) ) { $ response -> setResponseCode ( $ data [ 'responseCode' ] ) ; unset ( $ data [ 'responseCode' ] ) ; } $ response -> setContent ( $ data ) ; } catch ( Exception $ ex ) { $ response -> setResponseCode ( 500 ) ; $ response -> setContent ( array ( 'status' => 'failed' , 'error' => $ ex -> getMessage ( ) ) ) ; } return $ response ; }
Handle the action, Ensuring to return a JsonResponse.

@param string $action
@param mixed $actionParams

@return \b8\Http\Response
Handle the action Ensuring to return a JsonResponse .