Skip to content

Commit 5636e49

Browse files
author
Alex Hotsaliyk
committed
PriceListTreeHandler TypeErrors fix
1 parent eee9924 commit 5636e49

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,22 @@ public function __construct(
7575
* @param Customer|null $customer
7676
* @param Website|null $website
7777
* @return CombinedPriceList|null
78+
*
79+
* @throws \LogicException
7880
*/
7981
public function getPriceList(Customer $customer = null, Website $website = null)
8082
{
8183
if (!$website) {
8284
$website = $this->websiteManager->getCurrentWebsite();
8385
}
8486

87+
if (null === $website) {
88+
throw new \LogicException(\sprintf(
89+
'When "%s" is called not in a storefront context, a website must be passed as a parameter',
90+
__METHOD__
91+
));
92+
}
93+
8594
$key = $this->getUniqueKey($customer, $website);
8695
if (array_key_exists($key, $this->priceLists)) {
8796
return $this->priceLists[$key];
@@ -123,8 +132,8 @@ protected function getPriceListByCustomer(Customer $customer, Website $website)
123132
}
124133

125134
/**
126-
* @param Customer|null $customer
127-
* @param Website|null $website
135+
* @param Customer $customer
136+
* @param Website $website
128137
* @return null|CombinedPriceList
129138
*/
130139
protected function getPriceListByCustomerGroup(Customer $customer, Website $website)
@@ -139,7 +148,7 @@ protected function getPriceListByCustomerGroup(Customer $customer, Website $webs
139148
}
140149

141150
/**
142-
* @param Website|null $website
151+
* @param Website $website
143152
* @return null|CombinedPriceList
144153
*/
145154
protected function getPriceListByAnonymousCustomerGroup(Website $website)

0 commit comments

Comments
 (0)