Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php
Original file line number Diff line number Diff line change
@@ -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];
@@ -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)