diff --git a/src/Provider/ProductUrlProvider.php b/src/Provider/ProductUrlProvider.php index 772fa0e..b56777c 100644 --- a/src/Provider/ProductUrlProvider.php +++ b/src/Provider/ProductUrlProvider.php @@ -13,7 +13,7 @@ namespace MonsieurBiz\SyliusMenuPlugin\Provider; -use Sylius\Component\Core\Model\Product; +use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Repository\ProductRepositoryInterface; use Symfony\Component\Routing\RouterInterface; use Webmozart\Assert\Assert; @@ -56,7 +56,9 @@ protected function getResults(string $locale, string $search = ''): iterable protected function addItemFromResult(object $result, string $locale): void { - Assert::isInstanceOf($result, Product::class); + Assert::isInstanceOf($result, ProductInterface::class); + /** @var ProductInterface $result */ + $result->setCurrentLocale($locale); $this->addItem( (string) $result->getName(), $this->router->generate('sylius_shop_product_show', ['slug' => $result->getSlug(), '_locale' => $locale]) diff --git a/src/Provider/TaxonUrlProvider.php b/src/Provider/TaxonUrlProvider.php index e8404b6..4f91664 100644 --- a/src/Provider/TaxonUrlProvider.php +++ b/src/Provider/TaxonUrlProvider.php @@ -60,6 +60,8 @@ protected function getResults(string $locale, string $search = ''): iterable protected function addItemFromResult(object $result, string $locale): void { Assert::isInstanceOf($result, TaxonInterface::class); + /** @var TaxonInterface $result */ + $result->setCurrentLocale($locale); $this->addItem( (string) $result->getFullname(' > '), $this->router->generate('sylius_shop_product_index', ['slug' => $result->getSlug(), '_locale' => $locale])