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

magento/magento2#37864: Removed unused class from ProductRepository #37868

Merged

Conversation

BeggiNN
Copy link
Contributor

@BeggiNN BeggiNN commented Aug 9, 2023

  • Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper from \Magento\Catalog\Model\ProductRepository

Description (*)

Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper which is an Adminhtml controller from \Magento\Catalog\Model\ProductRepository.

When trying to use the rest-api with an oauth authorization, the Magento\Framework\App\Http class is triggered, which first tries to get the area code of the current url. But then the custom logic by the third party is triggered, finally loading in the productRepository. The productRepository then tries to load the above mentioned adminhtml controller, which tries to access the roleLocatorInterface, which is now not based on the webapi_rest/di.xml, but on the default app/etc/di.xml. Causing the Magento\Framework\Authorization\RoleLocator\DefaultRoleLocator to be loaded instead of the Magento\Framework\Authorization\RoleLocatorInterface\WebapiRoleLocator. This last thing causes the authorization to fail, as the DefaultRoleLocator returns '' instead of executing logic like the WebapiRoleLocator.

Fixed Issues (if relevant)

  1. Fixes ProductRepository is loading initializationHelper which is an Adminhtml controller  #37864

Manual testing scenarios (*)

  1. ...
  2. ...

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

- Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper from \Magento\Catalog\Model\ProductRepository
@m2-assistant
Copy link

m2-assistant bot commented Aug 9, 2023

Hi @BeggiNN. Thank you for your contribution!
Here are some useful tips on 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 give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Aug 9, 2023
@m2-github-services m2-github-services added Partner: Perspective Studio partners-contribution Pull Request is created by Magento Partner labels Aug 9, 2023
@m2-community-project m2-community-project bot added this to Pending Review in Pull Requests Dashboard Aug 9, 2023
@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 9, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 9, 2023

@BeggiNN looks like you described a 2nd issue that this PR fixes.
Could you please report a separate issue for tracking the fix? I think it will require additional test coverage.

Edit: sorry, that's exactly the same issue. So everything is fine.
PS: I also expect to see some performance benefit from this change since product repository used in many places, and it won't require creating and initializing all the dependencies of \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 9, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 10, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@ihor-sviziev ihor-sviziev self-assigned this Aug 10, 2023
@m2-community-project m2-community-project bot moved this from Pending Review to Review in Progress in Pull Requests Dashboard Aug 10, 2023
@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 10, 2023

@magento run Unit Tests, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 8, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 8, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@magento-automated-testing
Copy link

Failed to run the builds. Please try to re-run them later.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 11, 2023

@magento run Semantic Version Checker, Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@sinhaparul sinhaparul added the Project: Community Picked PRs upvoted by the community label Sep 13, 2023
@m2-community-project m2-community-project bot added this to Review in Progress in Community Dashboard Sep 13, 2023
@m2-community-project m2-community-project bot removed this from Review in Progress in Pull Requests Dashboard Sep 13, 2023
@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 14, 2023

@magento run Integration Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 15, 2023

@magento run Integration Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE, Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@m2-community-project m2-community-project bot moved this from Review in Progress to Ready for Testing in Community Dashboard Sep 15, 2023
@engcom-Lima engcom-Lima added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 25, 2023
@engcom-Echo engcom-Echo self-assigned this Oct 4, 2023
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

✔️ QA Passed

QA not required.

@engcom-Echo engcom-Echo moved this from Ready for Testing to Merge in Progress in Community Dashboard Oct 4, 2023
@magento-devops-reposync-svc magento-devops-reposync-svc merged commit e53ad73 into magento:2.4-develop Oct 20, 2023
12 checks passed
@engcom-Charlie engcom-Charlie moved this from Merge in Progress to Recently Merged in Community Dashboard Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: Perspective Studio partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Community Dashboard
Recently Merged
Development

Successfully merging this pull request may close these issues.

ProductRepository is loading initializationHelper which is an Adminhtml controller
8 participants