Skip to content

Commit

Permalink
PriceListTreeHandler TypeErrors fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Hotsaliyk committed Sep 29, 2020
1 parent eee9924 commit 5636e49
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,22 @@ 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)
{
if (!$website) {
$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];
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 5636e49

Please sign in to comment.