From b79daf00d9c5d891efacc493842cc16949bb6b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20D=C3=BCnser?= Date: Thu, 25 Mar 2021 14:00:18 +0100 Subject: [PATCH] Fixed route provider regarding published state and ghost content (#555) * Fixed route provider regarding published state and ghost content * Added locale to test * Replaced tab with spaces * Fixed test --- Routing/ArticleRouteDefaultProvider.php | 8 +++++++- Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Routing/ArticleRouteDefaultProvider.php b/Routing/ArticleRouteDefaultProvider.php index 9ec36b0fc..83e48fc26 100644 --- a/Routing/ArticleRouteDefaultProvider.php +++ b/Routing/ArticleRouteDefaultProvider.php @@ -118,7 +118,13 @@ public function getByEntity($entityClass, $id, $locale, $object = null) */ public function isPublished($entityClass, $id, $locale) { - $object = $this->documentManager->find($id, $locale); + $object = $this->documentManager->find( + $id, + $locale, + [ + 'load_ghost_content' => false, + ] + ); if (!$object instanceof ArticleInterface || WorkflowStage::PUBLISHED !== $object->getWorkflowStage()) { return false; diff --git a/Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php b/Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php index bb6c0205b..fce25d558 100644 --- a/Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php +++ b/Tests/Unit/Routing/ArticleRouteDefaultProviderTest.php @@ -130,7 +130,13 @@ public function testIsPublished( $this->webspaceResolver->resolveAdditionalWebspaces($document)->willReturn($documentAdditionalWebspaces); } - $this->documentManager->find($this->entityId, $this->locale)->willReturn($document); + $this->documentManager->find( + $this->entityId, + $this->locale, + [ + 'load_ghost_content' => false, + ] + )->willReturn($document); $webspace = $this->prophesize(Webspace::class); $webspace->getKey()->willReturn($webspaceKey);