src/Listener/ApiListener.php
protected function _ensureSerialize()
    {
        $controller = $this->_controller();

        if (isset($controller->viewVars['_serialize'])) {
            return;
        }

        $serialize = [];
        $serialize[] = 'success';

        $action = $this->_action();
        if (method_exists($action, 'viewVar')) {
            $serialize['data'] = $action->viewVar();
        } else {
            $serialize[] = 'data';
        }

        $serialize = array_merge($serialize, (array)$action->getConfig('serialize'));
        $controller->set('_serialize', $serialize);
    }
protected function _ensureSerialize()
    {
        $controller = $this->_controller();

        if (isset($controller->viewVars['_serialize'])) {
            return;
        }

        $serialize = [];
        $serialize[] = 'success';

        $action = $this->_action();
        if (method_exists($action, 'viewVar')) {
            $serialize['data'] = $action->viewVar();
        } else {
            $serialize[] = 'data';
        }

        $serialize = array_merge($serialize, (array)$action->getConfig('serialize'));
        $controller->set('_serialize', $serialize);
    }
protected function _ensureSerialize ( ) { $ controller = $ this -> _controller ( ) ; if ( isset ( $ controller -> viewVars [ '_serialize' ] ) ) { return ; } $ serialize = [ ] ; $ serialize [ ] = 'success' ; $ action = $ this -> _action ( ) ; if ( method_exists ( $ action , 'viewVar' ) ) { $ serialize [ 'data' ] = $ action -> viewVar ( ) ; } else { $ serialize [ ] = 'data' ; } $ serialize = array_merge ( $ serialize , ( array ) $ action -> getConfig ( 'serialize' ) ) ; $ controller -> set ( '_serialize' , $ serialize ) ; }
Ensure _serialize is set in the view

@return void
Ensure _serialize is set in the view