Skip to content

Commit 7e192b0

Browse files
authored
Merge pull request #111 from JordiDekker/bugfix/main-request
Symfony 6 compatability fix
2 parents cffed86 + 0d1454f commit 7e192b0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"doctrine/persistence": "^1.3 || ^2.1",
1717
"league/uri": "^6.0",
1818
"league/uri-components": "^2.3",
19+
"setono/symfony-main-request-trait": "^1.0",
1920
"sylius/resource-bundle": "^1.6",
2021
"symfony/config": "^5.4 || ^6.0",
2122
"symfony/console": "^5.4 || ^6.0",

src/EventListener/NotFoundSubscriber.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Setono\SyliusRedirectPlugin\EventListener;
66

77
use Doctrine\Persistence\ObjectManager;
8+
use Setono\MainRequestTrait\MainRequestTrait;
89
use Setono\SyliusRedirectPlugin\Resolver\RedirectionPathResolverInterface;
910
use Sylius\Component\Channel\Context\ChannelContextInterface;
1011
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -16,6 +17,8 @@
1617

1718
class NotFoundSubscriber implements EventSubscriberInterface
1819
{
20+
use MainRequestTrait;
21+
1922
use RedirectResponseTrait;
2023

2124
/** @var ObjectManager */
@@ -46,7 +49,7 @@ public static function getSubscribedEvents(): array
4649

4750
public function onKernelException(ExceptionEvent $event): void
4851
{
49-
if (!$event->isMasterRequest()) {
52+
if (!$this->isMainRequest($event)) {
5053
return;
5154
}
5255

0 commit comments

Comments
 (0)