src/Controller/Component/CrudComponent.php
public function execute($controllerAction = null, $args = [])
    {
        $this->_loadListeners();

        $this->_action = $controllerAction ?: $this->_action;

        $action = $this->_action;
        if (empty($args)) {
            $args = $this->_request->getParam('pass');
        }

        try {
            $event = $this->trigger('beforeHandle', $this->getSubject(compact('args', 'action')));

            $response = $this->action($event->getSubject()->action)->handle($event->getSubject()->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);
    }
public function execute($controllerAction = null, $args = [])
    {
        $this->_loadListeners();

        $this->_action = $controllerAction ?: $this->_action;

        $action = $this->_action;
        if (empty($args)) {
            $args = $this->_request->getParam('pass');
        }

        try {
            $event = $this->trigger('beforeHandle', $this->getSubject(compact('args', 'action')));

            $response = $this->action($event->getSubject()->action)->handle($event->getSubject()->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);
    }
public function execute ( $ controllerAction = null , $ args = [ ] ) { $ this -> _loadListeners ( ) ; $ this -> _action = $ controllerAction ? : $ this -> _action ; $ action = $ this -> _action ; if ( empty ( $ args ) ) { $ args = $ this -> _request -> getParam ( 'pass' ) ; } try { $ event = $ this -> trigger ( 'beforeHandle' , $ this -> getSubject ( compact ( 'args' , 'action' ) ) ) ; $ response = $ this -> action ( $ event -> getSubject ( ) -> action ) -> handle ( $ event -> getSubject ( ) -> 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 ) ; }
Execute a Crud action

@param string $controllerAction Override the controller action to execute as.
@param array $args List of arguments to pass to the CRUD action (Usually an ID to edit / delete).
@return \Cake\Http\Response
@throws Exception If an action is not mapped.
Execute a Crud action