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

Conversation

artoasmith
Copy link

PriceListTreeHandler TypeErrors fix in case when Oro\Bundle\WebsiteBundle\Manager\WebsiteManager::getCurrentWebsite returns null value.

Related to #118

@orocla
Copy link

orocla commented Sep 25, 2020

Thank you for your pull request.

It looks like this may be your first contribution to an Oro, Inc. open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://oroinc.com/b2b-ecommerce/contributor-license-agreement/

If you've already signed the CLA, it's possible we don't have your GitHub username or you're using a different email address. GitHub uses the email address you set in your local Git configuration to associate commits with your GitHub account. Please sign the CLA again using the correct GitHub username and email address or see this help article on setting the email on your git commits.

Once you've signed the CLA, please allow for some time for the submission to be processed.

@mbessolov
Copy link
Member

mbessolov commented Sep 26, 2020

Hi @artoasmith,

Thank you for the proposed fix.

I do not see though why you want this method to silently ignore the problem. Normally, if this method is called somewhere in the context of processing a storefront web request, the website manager service will return some non-null website. And if you want to use this method in the back-office (or message processor, or console command, etc.), you would pass a website as a parameter. Logically then the fix would be to add a guard and trigger an exception, and describe this in the method's phpdoc, e.g.

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__));
}

Please provide the STR or a stacktrace of how you got this method called without a website parameter and not on a storefront.

Thank you.

@mbessolov mbessolov self-assigned this Sep 26, 2020
@artoasmith artoasmith force-pushed the pricelisttree-website-fix branch from 1cda865 to 5636e49 Compare September 29, 2020 07:03
@artoasmith
Copy link
Author

I found this exception after initializing storefront Datagrid on the back-office. As a result, I got a TypeError exception instead of more propper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants