Skip to content

Commit

Permalink
Fix routePath in ArticleTrashItemHandler (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlagler authored Feb 5, 2024
1 parent 387625a commit 93d992b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion Tests/Functional/Trash/ArticleTrashItemHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function testStoreAndRestoreShadowArticle(): void
$restoredArticleEn = $this->documentManager->find($restoredArticle->getUuid(), 'en');
static::assertSame('target-locale-title', $restoredArticleEn->getTitle());
static::assertSame('de', $restoredArticleEn->getLocale());
static::assertSame('source-locale-route-path', $restoredArticleEn->getRoutePath());
static::assertSame('target-locale-route-path', $restoredArticleEn->getRoutePath());
static::assertSame('target locale article content', $restoredArticleEn->getStructure()->toArray()['article']);
static::assertSame('en', $restoredArticleEn->getOriginalLocale());
static::assertSame('de', $restoredArticleEn->getShadowLocale());
Expand Down
2 changes: 0 additions & 2 deletions Trash/ArticleTrashItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Sulu\Bundle\ArticleBundle\Admin\ArticleAdmin;
use Sulu\Bundle\ArticleBundle\Controller\ArticleController;
use Sulu\Bundle\ArticleBundle\Document\ArticleDocument;
use Sulu\Bundle\ArticleBundle\Document\Subscriber\RoutableSubscriber;
use Sulu\Bundle\ArticleBundle\Domain\Event\ArticleRestoredEvent;
use Sulu\Bundle\ArticleBundle\Domain\Event\ArticleTranslationRestoredEvent;
use Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector;
Expand Down Expand Up @@ -97,7 +96,6 @@ public function store(object $article, array $options = []): TrashItemInterface
// routePath property of structure contains route of target locale in case of a shadow page
// we want to restore the path of the source locale, therefore we use the value of the document
$structureData = $localizedArticle->getStructure()->toArray();
$structureData[RoutableSubscriber::ROUTE_FIELD] = $localizedArticle->getRoutePath();

$articleTitles[$locale] = $localizedArticle->getTitle();

Expand Down

0 comments on commit 93d992b

Please sign in to comment.