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

Fix > Exception #0 (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator. #22191

Conversation

lfluvisotto
Copy link
Contributor

@lfluvisotto lfluvisotto commented Apr 7, 2019

Description (*)

Fix > Exception #0 (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator.

Fixed Issues (if relevant)

#22190: Exception (BadMethodCallException): Missing required argument $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator.

Manual testing scenarios (*)

  1. Modules Magento_MsrpConfigurableProduct or Magento_MsrpGroupedProduct must be enable for module Magento_Msrp works properly

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@m2-assistant
Copy link

m2-assistant bot commented Apr 7, 2019

Hi @lfluvisotto. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@@ -9,6 +9,8 @@
<module name="Magento_Msrp" >
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_MsrpConfigurableProduct"/>
<module name="Magento_MsrpGroupedProduct"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such dependency is incorrect. Those modules must depend on Msrp and not vise versa.

Copy link
Contributor Author

@lfluvisotto lfluvisotto Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlangur

In > app/code/Magento/MsrpConfigurableProduct/etc/module.xml there is the dependency / sequence with module Magento_Msrp, so far, so good.

In > app/code/Magento/MsrpGroupedProduct/etc/module.xml there is the dependency / sequence with module Magento_Msrp, so far, so good.

But if you disable these modules MsrpConfigurableProduct and MsrpGroupedProduct, the module Magento_Msrp is dependent of MsrpConfigurableProduct or MsrpGroupedProduct.

The file app/code/Magento/Msrp/Pricing/MsrpPriceCalculator.php > public function __construct(array $msrpPriceCalculators) > it's supposed to receive as an argument MsrpConfigurableProduct or MsrpGroupedProduct

With both modules MsrpConfigurableProduct and MsrpGroupedProduct disabled the crash happens.

These are declared in:

app/code/Magento/MsrpConfigurableProduct/etc/di.xml

app/code/Magento/MsrpGroupedProduct/etc/di.xml

The way Magento_Msrp was built/developed is dependent of MsrpConfigurableProduct and MsrpGroupedProduct

Have a look at this commit:

db2e9f0

MsrpConfigurableProduct provides type and resolver information for the Msrp module from the ConfigurableProduct module.

MsrpGroupedProduct provides type and resolver information for the Msrp module from the GroupedProduct module.

Msrp is attached to MsrpConfigurableProduct and MsrpGroupedProduct

@lfluvisotto
Copy link
Contributor Author

@davidverholen @orlangur

I've checked again my solution but it's wrong it's generating > Circular sequence reference

Disregard my pull request, a refactoring is necessary in Magento_Msrp, possibly in app/code/Magento/Msrp/Pricing/MsrpPriceCalculator.php

…t $msrpPriceCalculators of Magento\Msrp\Pricing\MsrpPriceCalculator.
@lfluvisotto lfluvisotto force-pushed the 2-3-develop-BadMethodCallException branch from 7e92e39 to fc26316 Compare April 8, 2019 03:08
@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2019

Hi @lfluvisotto, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@lfluvisotto lfluvisotto closed this Apr 8, 2019
@lfluvisotto lfluvisotto deleted the 2-3-develop-BadMethodCallException branch April 8, 2019 03:10
@lfluvisotto
Copy link
Contributor Author

@davidverholen @orlangur

Have a look at my new pull request #22197

I hope it's ok now.

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

Successfully merging this pull request may close these issues.

4 participants