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)