src/Graviton/RestBundle/Subscriber/RestEventSubscriber.php
private function getEventObject(Event $event)
    {
        // get the service name
        list ($serviceName) = explode(":", $event->getRequest()->get('_controller'));

        // get the controller which handles this request
        if ($this->container->has($serviceName)) {
            $controller = $this->container->get($serviceName);
            $restEvent = $this->restEvent;
            $restEvent->setRequest($event->getRequest());
            $restEvent->setResponse($this->response);
            $restEvent->setController($controller);

            $returnEvent = $restEvent;
        } else {
            $returnEvent = $event;
        }

        return $returnEvent;
    }
private function getEventObject(Event $event)
    {
        // get the service name
        list ($serviceName) = explode(":", $event->getRequest()->get('_controller'));

        // get the controller which handles this request
        if ($this->container->has($serviceName)) {
            $controller = $this->container->get($serviceName);
            $restEvent = $this->restEvent;
            $restEvent->setRequest($event->getRequest());
            $restEvent->setResponse($this->response);
            $restEvent->setController($controller);

            $returnEvent = $restEvent;
        } else {
            $returnEvent = $event;
        }

        return $returnEvent;
    }
private function getEventObject ( Event $ event ) { // get the service name list ( $ serviceName ) = explode ( ":" , $ event -> getRequest ( ) -> get ( '_controller' ) ) ; // get the controller which handles this request if ( $ this -> container -> has ( $ serviceName ) ) { $ controller = $ this -> container -> get ( $ serviceName ) ; $ restEvent = $ this -> restEvent ; $ restEvent -> setRequest ( $ event -> getRequest ( ) ) ; $ restEvent -> setResponse ( $ this -> response ) ; $ restEvent -> setController ( $ controller ) ; $ returnEvent = $ restEvent ; } else { $ returnEvent = $ event ; } return $ returnEvent ; }
Get a RestEvent object -> put this in a factory

@param Event $event Original event (kernel.request / kernel.response)

@return RestEvent $restEvent
Get a RestEvent object - > put this in a factory