Exemplo n.º 1
0
 public function redirectAfterRegistration(Event $event)
 {
     $url = $this->router->generate('homepage');
     $response = new RedirectResponse($url);
     $event->setResponse($response);
 }
Exemplo n.º 2
0
 private function forward($controller, Event $event)
 {
     $attributes = ['_controller' => $controller];
     if ($event instanceof CustomActionResourceEvent) {
         $attributes['id'] = $event->getResource()->getId();
     }
     $subRequest = $this->request->duplicate([], null, $attributes);
     $response = $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     if ($event instanceof DisplayToolEvent || $event instanceof DisplayWidgetEvent) {
         $event->setContent($response->getContent());
     } else {
         $event->setResponse($response);
     }
     $event->stopPropagation();
 }