protected function invokeAction($type = self::MASTER_REQUEST)
    {
        $this->dispatch('frontcontroller.request');

        $request = $this->getRequest();
        $controllerResolver = $this->getApplication()->getContainer()->get('controller_resolver');
        $controller = $controllerResolver->getController($request);

        // logout Event dispatch
        if (
            null !== $request->get('logout')
            && true === $request->get('logout')
            && true === $this->getApplication()->getSecurityContext()->isGranted('IS_AUTHENTICATED_FULLY')
        ) {
            $this->dispatch('frontcontroller.request.logout');
        }

        if (null !== $controller) {
            $dispatcher = $this->application->getEventDispatcher();

            // dispatch kernel.controller event
            $event = new FilterControllerEvent($this, $controller, $request, $type);
            $dispatcher->dispatch(KernelEvents::CONTROLLER, $event);

            // a listener could have changed the controller
            $controller = $event->getController();

            $eventName = $this->getControllerActionEventName($controller[0], $request->attributes->get('_action'));
            $dispatcher->dispatch($eventName.'.precall', new Event\PreRequestEvent($request));

            // get controller action arguments
            $actionArguments = $controllerResolver->getArguments($request, $controller);

            $response = call_user_func_array($controller, $actionArguments);
            if (!($response instanceof Response)) {
                $this->application->warning(sprintf(
                    'Action %s from controller %s should return an object Response, got %s.',
                    $request->attributes->get('_action'),
                    get_class($controller[0]),
                    gettype($response)
                ));

                $response = new Response();
            }
            $dispatcher->dispatch($eventName.'.postcall', new Event\PostResponseEvent($response, $request));

            return $response;
        } else {
            throw new FrontControllerException(
                sprintf('Unknown action `%s`.', $request->attributes->get('_action')),
                FrontControllerException::BAD_REQUEST
            );
        }
    }
protected function invokeAction($type = self::MASTER_REQUEST)
    {
        $this->dispatch('frontcontroller.request');

        $request = $this->getRequest();
        $controllerResolver = $this->getApplication()->getContainer()->get('controller_resolver');
        $controller = $controllerResolver->getController($request);

        // logout Event dispatch
        if (
            null !== $request->get('logout')
            && true === $request->get('logout')
            && true === $this->getApplication()->getSecurityContext()->isGranted('IS_AUTHENTICATED_FULLY')
        ) {
            $this->dispatch('frontcontroller.request.logout');
        }

        if (null !== $controller) {
            $dispatcher = $this->application->getEventDispatcher();

            // dispatch kernel.controller event
            $event = new FilterControllerEvent($this, $controller, $request, $type);
            $dispatcher->dispatch(KernelEvents::CONTROLLER, $event);

            // a listener could have changed the controller
            $controller = $event->getController();

            $eventName = $this->getControllerActionEventName($controller[0], $request->attributes->get('_action'));
            $dispatcher->dispatch($eventName.'.precall', new Event\PreRequestEvent($request));

            // get controller action arguments
            $actionArguments = $controllerResolver->getArguments($request, $controller);

            $response = call_user_func_array($controller, $actionArguments);
            if (!($response instanceof Response)) {
                $this->application->warning(sprintf(
                    'Action %s from controller %s should return an object Response, got %s.',
                    $request->attributes->get('_action'),
                    get_class($controller[0]),
                    gettype($response)
                ));

                $response = new Response();
            }
            $dispatcher->dispatch($eventName.'.postcall', new Event\PostResponseEvent($response, $request));

            return $response;
        } else {
            throw new FrontControllerException(
                sprintf('Unknown action `%s`.', $request->attributes->get('_action')),
                FrontControllerException::BAD_REQUEST
            );
        }
    }
protected function invokeAction ( $ type = self :: MASTER_REQUEST ) { $ this -> dispatch ( 'frontcontroller.request' ) ; $ request = $ this -> getRequest ( ) ; $ controllerResolver = $ this -> getApplication ( ) -> getContainer ( ) -> get ( 'controller_resolver' ) ; $ controller = $ controllerResolver -> getController ( $ request ) ; // logout Event dispatch if ( null !== $ request -> get ( 'logout' ) && true === $ request -> get ( 'logout' ) && true === $ this -> getApplication ( ) -> getSecurityContext ( ) -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { $ this -> dispatch ( 'frontcontroller.request.logout' ) ; } if ( null !== $ controller ) { $ dispatcher = $ this -> application -> getEventDispatcher ( ) ; // dispatch kernel.controller event $ event = new FilterControllerEvent ( $ this , $ controller , $ request , $ type ) ; $ dispatcher -> dispatch ( KernelEvents :: CONTROLLER , $ event ) ; // a listener could have changed the controller $ controller = $ event -> getController ( ) ; $ eventName = $ this -> getControllerActionEventName ( $ controller [ 0 ] , $ request -> attributes -> get ( '_action' ) ) ; $ dispatcher -> dispatch ( $ eventName . '.precall' , new Event \ PreRequestEvent ( $ request ) ) ; // get controller action arguments $ actionArguments = $ controllerResolver -> getArguments ( $ request , $ controller ) ; $ response = call_user_func_array ( $ controller , $ actionArguments ) ; if ( ! ( $ response instanceof Response ) ) { $ this -> application -> warning ( sprintf ( 'Action %s from controller %s should return an object Response, got %s.' , $ request -> attributes -> get ( '_action' ) , get_class ( $ controller [ 0 ] ) , gettype ( $ response ) ) ) ; $ response = new Response ( ) ; } $ dispatcher -> dispatch ( $ eventName . '.postcall' , new Event \ PostResponseEvent ( $ response , $ request ) ) ; return $ response ; } else { throw new FrontControllerException ( sprintf ( 'Unknown action `%s`.' , $ request -> attributes -> get ( '_action' ) ) , FrontControllerException :: BAD_REQUEST ) ; } }
Invokes associated action to the current request.

@access private

@param int $type request type

@throws FrontControllerException
Invokes associated action to the current request .