Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PriceListTreeHandler TypeErrors fix #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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