-
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
#14061 Fix Configurable Product Type resource model 'getChildrenIds' method return format #27246
Conversation
Hi @vasilii-b. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
@magento run all tests |
@magento run Integration Tests |
UPD |
Hi @dmytro-ch, |
@vasilii-b thank you for the updates! I've tested the current solution with Content Staging Updates and it works like a charm now. 👍 Example of resulting query:
@vasilii-b, could you please just squash all commits into a single commit in order to cleanup history? Thank you! |
Hi @dmytro-ch, |
d6f1514
to
b362648
Compare
@dmytro-ch the changes have been squashed ✅ |
Hi @dmytro-ch, thank you for the review. |
Hi @engcom-Alfa, @dmytro-ch, |
… 14061-Configurable-Product-Type-resource-model-getChildrenIds-method-incorrect-return-format
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 @vasilii-b, @dmytro-ch. Thanks for collaboration. I not sure that structure like
[ "parent id" => ["child id"]]
is correct in this case. The method name is getChildrenIds
and it should return just an array of ids, like ['child id', 'child id', 'child id'], without nested structure and mentions parent id.
Hi @VladimirZaets, Let me please bring some light here. magento2/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php Lines 150 to 188 in e5ea17f
It accepts as the first parameter When you call the method [
0 => [ 40, 5, 20, 23, 98 ]
];
// in other words
[
0 => ['child id', 'child id', 'child id', 'child id']
] Tell me please, how do you know which child id belongs to what parent id you have passed to the original method? With the fix from this PR the result will be [
0 => [ 40, 5, 20, 23, 98 ], // for backward compatibility
4 => [40, 5],
10 => [20, 23]
99 => [98]
];
// in other words
[
0 => ['child id', 'child id', 'child id', 'child id'], // backward compatibility
'parent id' => ['child id', 'child id', 'child id', 'child id']
] Please let me know should there be any questions. Thank you!. |
@vasilii-b yes, sorry I missed that we can pass an array of parent ids there, but I still have concerns due to this method. Return type array of arrays, a method that can receive as parameter int or array, required param that is unused, all of this looks weird. Maybe we should deprecate this method and create a new one. I think this PR is a good candidate for group code review |
Hello @vasilii-b, unfortunately, I have to close this PR due to inactivity. |
Hi @vasilii-b, thank you for your contribution! |
Description (*)
This PR fixes the return type of
Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable:getChildrenIds
method.Related Pull Requests
#15167 - Closed and inactive
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
N/A
Contribution checklist (*)