From 89d388ba0fd6df4bbeced4d9be4cfffafd424472 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Wed, 13 Mar 2024 09:58:43 +0100 Subject: [PATCH] NTR: fix routing for 6.5 --- src/Compatibility/DependencyLoader.php | 1 - src/Subscriber/KernelSubscriber.php | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Compatibility/DependencyLoader.php b/src/Compatibility/DependencyLoader.php index e5bc40b8e..6a06112f3 100644 --- a/src/Compatibility/DependencyLoader.php +++ b/src/Compatibility/DependencyLoader.php @@ -82,5 +82,4 @@ public function prepareStorefrontBuild(): void # copy($file, $target); } } - } diff --git a/src/Subscriber/KernelSubscriber.php b/src/Subscriber/KernelSubscriber.php index 6efa238dc..dc996e0d9 100644 --- a/src/Subscriber/KernelSubscriber.php +++ b/src/Subscriber/KernelSubscriber.php @@ -24,8 +24,14 @@ public function onModifyRouteScope(ControllerEvent $event): void /** @var null|RouteScope|string $routeScope */ $routeScope = $attributes->get(PlatformRequest::ATTRIBUTE_ROUTE_SCOPE); + if (is_string($routeScope)) { - $routeScope = new RouteScope(['scopes'=>[$routeScope]]); + $routeScope = [$routeScope]; + + if (class_exists(RouteScope::class)) { + $routeScope = new RouteScope(['scopes' => [$routeScope]]); + } + $attributes->set(PlatformRequest::ATTRIBUTE_ROUTE_SCOPE, $routeScope); }