Skip to content

Commit

Permalink
Fixed Travis CI build failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Janak committed Feb 12, 2019
1 parent 78df524 commit 7ebc03f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,16 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
UrlRewrite::STORE_ID => $oldStoreId,
]);
if ($oldRewrite) {
$targetUrl = $targetStore->getBaseUrl();
// look for url rewrite match on the target store
$currentRewrites = $this->urlFinder->findAllByData([
$currentRewrite = $this->urlFinder->findOneByData([
UrlRewrite::TARGET_PATH => $oldRewrite->getTargetPath(),
UrlRewrite::STORE_ID => $targetStore->getId(),
]);
if (null === $currentRewrites || empty($currentRewrites)) {
/** @var \Magento\Framework\App\Response\Http $response */
$targetUrl = $targetStore->getBaseUrl();
return $targetUrl;
}
foreach ($currentRewrites as $rewrite) {
$targetUrl = $targetStore->getBaseUrl() . $rewrite->getRequestPath();
if ($currentRewrite) {
$targetUrl .= $currentRewrite->getRequestPath();
}
}

return $targetUrl;
}
}

0 comments on commit 7ebc03f

Please sign in to comment.