diff --git a/Document/Subscriber/RoutableSubscriber.php b/Document/Subscriber/RoutableSubscriber.php index 0cac1bf58..19068b58c 100644 --- a/Document/Subscriber/RoutableSubscriber.php +++ b/Document/Subscriber/RoutableSubscriber.php @@ -235,7 +235,12 @@ public function handlePublish(PublishEvent $event) */ private function createOrUpdatePageRoute(RoutablePageBehavior $document, $locale) { - $route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale); + $route = $document->getRoute(); + + if (!$route) { + $route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale); + } + if ($route) { $document->setRoute($route); @@ -255,7 +260,12 @@ private function createOrUpdatePageRoute(RoutablePageBehavior $document, $locale */ private function createOrUpdateRoute(RoutableBehavior $document, $locale) { - $route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale); + $route = $document->getRoute(); + + if (!$route) { + $route = $this->routeRepository->findByEntity($document->getClass(), $document->getUuid(), $locale); + } + if ($route) { $document->setRoute($route);