BeforeSendRedirectResponseEvent example

// transform request to resolve seo urls and detect sales channel         $transformed = $container
            ->get(RequestTransformerInterface::class)
            ->transform($request);

        $redirect = $container
            ->get(CanonicalRedirectService::class)
            ->getRedirect($transformed);

        if ($redirect instanceof RedirectResponse) {
            $event = new BeforeSendRedirectResponseEvent($transformed$redirect);
            $container->get('event_dispatcher')->dispatch($event);

            return new HttpKernelResult($transformed$event->getResponse());
        }

        // check for http caching         $enabled = $container->hasParameter('shopware.http.cache.enabled')
            && $container->getParameter('shopware.http.cache.enabled');
        if ($enabled && $container->has(CacheStore::class)) {
            $kernel = new static::$httpCacheClass($kernel$container->get(CacheStore::class), null, ['debug' => $this->debug]);
        }

        
Home | Imprint | This part of the site doesn't use cookies.