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

Correct child node load when multiple calls to CategoryManagement::ge… #18705

Merged
merged 1 commit into from
Mar 8, 2019

Conversation

pmclain
Copy link
Contributor

@pmclain pmclain commented Oct 19, 2018

…tTree

Description (*)

Tree::getNode currently loads nodes using a resource singleton. The tree
resource's parent class contains the property _loaded and only loads child
nodes when _loaded is false. This behavior means only the first call to
CategoryManagement::getTree in a request returns child nodes.

Fixed Issues (if relevant)

  1. No children data for \Magento\Catalog\Model\CategoryManagement::getTree($categoryId) after first call. #17297 No children data for \Magento\Catalog\Model\CategoryManagement::getTree($categoryId) after first call

Manual testing scenarios (*)

  1. Create instance of \Magento\Catalog\Model\CategoryManagement
  2. Call CategoryManagement->getTree(1)->getChildrenData() multiple times
  3. The count of the result should be the same with each call

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)

@magento-engcom-team
Copy link
Contributor

Hi @pmclain. 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 $VERSION instance - deploy vanilla Magento instance

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

…tTree

Tree::getNode currently loads nodes using a resource singleton. The tree
resource's parent class contains the property _loaded and only loads child
nodes when _loaded is false. This behavior means only the first call to
CategoryManagement::getTree in a request returns child nodes.

Fixes magento#17297
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-3252 has been created to process this Pull Request

@ghost
Copy link

ghost commented Mar 8, 2019

Hi @pmclain, 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.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.2 milestone Mar 8, 2019
@ivan-vetoskin-racechip
Copy link

we have issue after update to 2.3.2 by call rest api
....rest/all/V1/categories?rootCategoryId=2&depth=3
all values in the response json/structure are empty!

working solution:
vendor/magento/module-catalog/Model/Category/Tree.php
method getNode line 101

change:
$this->categoryTree->addCollectionData($this->categoryCollection);
to
$categoryTree->addCollectionData($this->categoryCollection);

@ksaho2
Copy link

ksaho2 commented Nov 11, 2019

Thanks @ivan-vetoskin-racechip. This fixed the empty structures returned from the CategoryManagementInterface.

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.

7 participants