-
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
Added getScopeCacheKey in order to define the right cache key based on store ID #27142
base: 2.5-develop
Are you sure you want to change the base?
Added getScopeCacheKey in order to define the right cache key based on store ID #27142
Conversation
Hi @matiashidalgo. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @matiashidalgo,
According to phpdoc block https://github.com/magento/magento2/blob/8c36ea51fab3be7d3e2135c2e4cc386bd453673c/app/code/Magento/Catalog/Api/CategoryRepositoryInterface.php#L29
this class should retrieve only int, so we don't need to support other possible cases. So looks like we don't really need to fix it, as it's not an issue at all
Do you have this issue in magento core or in custom module?
As I said into the comments, the interface enforce it for API requests, but it doesn't work that way for instantiation from code, I saw the tests and I'll make a little change to the implementation. |
@matiashidalgo |
@ihor-sviziev I was the one who reported that issue internally for contribution. Change to throw Exception (or type hint for argument to --- EDIT |
…he right cache key
8c36ea5
to
69946cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @matiashidalgo,
I've added few comments, please adjust your solution.
There also some integration test failed because it used string store code instead of numeric id. Please fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @matiashidalgo,
Your changes looks good to me. Could you cover your changes with tests, for instance unit tests?
@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing functional tests are not related to changes in this pr
@magento run all tests |
dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php
Outdated
Show resolved
Hide resolved
…RepositoryTest.php Co-authored-by: Ihor Sviziev <[email protected]>
@magento run all tests |
@magento run Unit Tests, Functional Tests CE |
@magento run Functional Tests B2B, Functional Tests CE |
@magento run Functional Tests CE |
…tegory-repository
Moving this PR to on hold since we are not picking up any PRs against the 2.5-develop branch right now. Once we pick it up, we will move it to the appropriate status. |
Description (*)
This PR adds an small improvement to the instance cache into the categories repository cause it allows to receive store id or store code for attributes data retrieval but at the same time this store id / code is used as cache key which make it a double unnecessary category load when you request the category by same given store, first providing the store id and then providing store code.
Manual testing scenarios (*)
Questions or comments
Have in mind this issue is not reproducible from REST API given it enforces to use the store ID based on the PHP Docs from the interface.
Contribution checklist (*)
Resolved issues: