From 5636e492e17cd2c0ac487c60d23604c78acf3aca Mon Sep 17 00:00:00 2001 From: Alex Hotsaliyk Date: Tue, 29 Sep 2020 10:02:31 +0300 Subject: [PATCH] PriceListTreeHandler TypeErrors fix --- .../PricingBundle/Model/PriceListTreeHandler.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php b/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php index dd4684318d4..dbf84002296 100644 --- a/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php +++ b/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php @@ -75,6 +75,8 @@ public function __construct( * @param Customer|null $customer * @param Website|null $website * @return CombinedPriceList|null + * + * @throws \LogicException */ public function getPriceList(Customer $customer = null, Website $website = null) { @@ -82,6 +84,13 @@ public function getPriceList(Customer $customer = null, Website $website = null) $website = $this->websiteManager->getCurrentWebsite(); } + if (null === $website) { + throw new \LogicException(\sprintf( + 'When "%s" is called not in a storefront context, a website must be passed as a parameter', + __METHOD__ + )); + } + $key = $this->getUniqueKey($customer, $website); if (array_key_exists($key, $this->priceLists)) { return $this->priceLists[$key]; @@ -123,8 +132,8 @@ protected function getPriceListByCustomer(Customer $customer, Website $website) } /** - * @param Customer|null $customer - * @param Website|null $website + * @param Customer $customer + * @param Website $website * @return null|CombinedPriceList */ protected function getPriceListByCustomerGroup(Customer $customer, Website $website) @@ -139,7 +148,7 @@ protected function getPriceListByCustomerGroup(Customer $customer, Website $webs } /** - * @param Website|null $website + * @param Website $website * @return null|CombinedPriceList */ protected function getPriceListByAnonymousCustomerGroup(Website $website)