diff --git a/lib/Form/Processor/SystemUrlRedirectProcessor.php b/lib/Form/Processor/SystemUrlRedirectProcessor.php index 9446beb7c..41978fab2 100644 --- a/lib/Form/Processor/SystemUrlRedirectProcessor.php +++ b/lib/Form/Processor/SystemUrlRedirectProcessor.php @@ -8,8 +8,6 @@ namespace EzSystems\RepositoryForms\Form\Processor; -use eZ\Publish\API\Repository\LocationService; -use eZ\Publish\API\Repository\URLAliasService; use EzSystems\RepositoryForms\Event\FormActionEvent; use EzSystems\RepositoryForms\Event\RepositoryFormEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -21,26 +19,13 @@ class SystemUrlRedirectProcessor implements EventSubscriberInterface /** @var \Symfony\Component\Routing\RouterInterface */ private $router; - /** @var \eZ\Publish\API\Repository\URLAliasService */ - private $urlAliasService; - - /** @var \eZ\Publish\API\Repository\LocationService */ - private $locationService; - /** * @param \Symfony\Component\Routing\RouterInterface $router - * @param \eZ\Publish\API\Repository\URLAliasService $urlAliasService - * @param \eZ\Publish\API\Repository\LocationService $locationService - * @param array $siteaccessGroups */ public function __construct( - RouterInterface $router, - URLAliasService $urlAliasService, - LocationService $locationService + RouterInterface $router ) { $this->router = $router; - $this->urlAliasService = $urlAliasService; - $this->locationService = $locationService; } /** @@ -101,8 +86,11 @@ private function resolveSystemUrlRedirect(FormActionEvent $event): void return; } - $location = $this->locationService->loadLocation($params['locationId']); + $url = $this->router->generate( + '_ezpublishLocation', ['locationId' => $params['locationId']] + ); - $event->setResponse(new RedirectResponse($this->urlAliasService->reverseLookup($location)->path)); + $event->setResponse(new RedirectResponse($url)); } } +