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

dependency injection fails for \Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface #23717

Closed
ioweb-gr opened this issue Jul 16, 2019 · 9 comments
Assignees
Labels
Component: ConfigurableProduct Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Jul 16, 2019

Unlike other interface classes the \Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface doesn't seem to be usable via dependency injection.

Preconditions (*)

  1. Magento 2.3.1

Steps to reproduce (*)

  1. Create a new module and a class
  2. Add in the constructor the \Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface
    e.g.

   public function __construct(
        ProductRepositoryInterface $productRepository,
        CategoryRepositoryInterface $categoryRepository,
        LoggerInterface $logger,
        SearchCriteriaBuilderFactory $searchCriteriaBuilderFactory,
        CollectionFactory $collectionFactory,
        Product $productModel,
        Data $helper,
        \Magento\Framework\Filesystem\DirectoryList $directoryList,
        StoreManagerInterface $storeManager,
        \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurableType,
        State $state,
        PriceResolverInterface $configurableRegularPrice
    )

Expected result (*)

  1. The dependency is injected correctly

Actual result (*)

  1. PHP Error
    PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface in /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
    Stack trace:
    #0 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Configu...')
    Can you commit to repository a folder dev/tests/static ? #1 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Configu...')
    BUG FIX - Uncaught exception when accessing admin with none existent use... #2 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Configu...', NULL, 'configurableReg...', 'Vendor\Module...')
    __DIR__ Typo fixed #3 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManage in /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50
@m2-assistant
Copy link

m2-assistant bot commented Jul 16, 2019

Hi @ioweb-gr. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

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

@ioweb-gr do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jul 16, 2019
@arushi013
Copy link

arushi013 commented Jul 17, 2019

Issue is reproducible in Magento 2.3-develop and is coming because no preference are added for PriceResolverInterface.

@edenduong edenduong self-assigned this Jul 18, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jul 18, 2019

Hi @edenduong. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.
    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

@edenduong edenduong added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Jul 18, 2019
@ghost ghost removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jul 18, 2019
@ghost
Copy link

ghost commented Jul 18, 2019

✅ Confirmed by @edenduong
Thank you for verifying the issue! 👍 Your confirmation will help us to acknowledge and process this report.

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Jul 18, 2019

@edenduong Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • Add "Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guess
  • Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@edenduong edenduong added Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: ConfigurableProduct Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jul 18, 2019
@ghost ghost removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jul 18, 2019
@edenduong
Copy link
Contributor

Yes, the reason because no preference of PriceResolverInterface in di.xm

@m2-assistant
Copy link

m2-assistant bot commented Aug 2, 2019

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@shikhamis11 shikhamis11 added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 2, 2019
@ghost ghost unassigned shikhamis11 Aug 2, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @shikhamis11
Thank you for verifying the issue. Based on the provided information internal tickets MC-18893 were created

Issue Available: @shikhamis11, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@shikhamis11
Copy link
Member

since the issue is fixed and merged to 2.3-develop branch I am closing this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ConfigurableProduct Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

5 participants