-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix > Exception #0 (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator. #22197
Conversation
Hi @lfluvisotto. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@lfluvisotto unfortunately, only members of the maintainers team are allowed to assign developers to the pull request |
1 similar comment
@lfluvisotto unfortunately, only members of the maintainers team are allowed to assign developers to the pull request |
@lfluvisotto I think it should be sufficient to set the default value in the constructor to an empty array /**
* @param array $msrpPriceCalculators
*/
public function __construct(array $msrpPriceCalculators = [])
{
$this->msrpPriceCalculators = $this->getMsrpPriceCalculators($msrpPriceCalculators);
} The foreach in getMsrpPriceCalculators then just does nothing (if the other modules are disabled) and the getMsrpPriceValue should fall back to the default case |
040f206
to
7522b53
Compare
Sure, nice, I did the change. |
…t of Magento\Msrp\Pricing\MsrpPriceCalculator.
7522b53
to
1c98b32
Compare
Hi @orlangur, thank you for the review. |
✔️ QA passed |
Is there an eta for a fix release? We are trying to upgrade to 2.3.1 and getting this error. |
@cds-magento2 you can use fix from this PR, it is pretty trivial. Fix will be released no earlier than 2.3.2 is out. |
this PR doesn't solve the initial isue which is passing null into the method in the first place. \Magento\Msrp\Pricing\MsrpPriceCalculator::getMsrpPriceCalculators will also fail for the same reason the argument being null because it also requires an array and will throw the same error as Please make a testcase for PR a requirement.
would confirm the value is STILL |
@janmyszkier are you sure? why would someone pass null to it? The object manager should (and normally does) pass nothing if there is no di configuration and so the default value should be taken |
I believe you didn't understand root cause of the issue correctly, try more :) |
Hi @lfluvisotto, thank you for your contribution! |
…uired argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator. #22197
@orlangur truth is: the issue with passing null is different from initial comment in this thread (my bad), the issue with null is still there for multicurrency setup though but since I fixed this internally with an override I'll wait for 2.3.2 and maybe submit separate issue then. |
Description (*)
Fix > Exception #0 (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator.
The possible solution is a workaround for the case of modules Magento_MsrpConfigurableProduct and Magento_MsrpGroupedProduct are disabled.
Fixed Issues (if relevant)
#22090 MsrpPriceCalculator exception after upgrade to 2.3.1
#22190: Exception (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator.
Manual testing scenarios (*)
Contribution checklist (*)