Skip to content

Commit

Permalink
Merge pull request #2209 from pascalheidmann/fix-site-based-request-r…
Browse files Browse the repository at this point in the history
…esolver

Throw exception if site store isnt found in SiteBasedRequestResolver
  • Loading branch information
dpfaffenbauer authored Feb 16, 2023
2 parents a79f9b9 + 1982140 commit 4b04f76
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ public function __construct(
public function findStore(Request $request): ?StoreInterface
{
if (Site::isSiteRequest()) {
return $this->storeRepository->findOneBySite(Site::getCurrentSite()->getId());
$store = $this->storeRepository->findOneBySite(Site::getCurrentSite()->getId());

if ($store !== null) {
return $store;
}
}

$defaultStore = $this->storeRepository->findStandard();

if (null === $defaultStore) {
throw new StoreNotFoundException();
if ($defaultStore) {
return $defaultStore;
}

return $defaultStore;
throw new StoreNotFoundException();
}
}

0 comments on commit 4b04f76

Please sign in to comment.