-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[FEATURE] Don't load product collection in review observer #21200
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
[FEATURE] Don't load product collection in review observer #21200
Conversation
|
Hi @Den4ik. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
orlangur
left a comment
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.
Thanks @Den4ik for a new attempt to fix this, please help me with understanding its logic and let's make it actually happen (at last!).
app/code/Magento/Review/Observer/CatalogBlockProductListCollectionInitializeObserver.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Review/Observer/CatalogBlockProductListCollectionInitializeObserver.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Review/Observer/CatalogBlockProductListCollectionInitializeObserver.php
Outdated
Show resolved
Hide resolved
|
@magento-engcom-team give me test instance |
|
Hi @Den4ik. Thank you for your request. I'm working on Magento instance for you |
|
Hi @Den4ik, here is your new Magento instance. |
|
Hi @Den4ik, thank you for your contribution! |
|
@magento-engcom-team give me test instance |
|
Hi @Den4ik. Thank you for your request. I'm working on Magento instance for you |
|
Hi @Den4ik, here is your new Magento instance. |
|
@sivaschenko @orlangur Any progress on this request? |
|
Hi @Den4ik thanks for the pull request. Can you mark Block methods as deprecated instead of removing them to preserve backward compatibility? Also, our policies do not allow the introduction of new public/protected method for classes marked as API for patch releases (currently 2.3.X). Can you refactor the implementation to avoid adding such methods, or otherwise we'll have to delay delivery of this PR until version 2.4. |
|
@magento-engcom-team give me test instance |
|
Hi @Den4ik. Thank you for your request. I'm working on Magento instance for you |
|
Hi @Den4ik, here is your new Magento instance. |
ca7b1d9 to
20df8ca
Compare
|
@magento-engcom-team give me test instance |
|
Hi @Den4ik. Thank you for your request. I'm working on Magento instance for you |
|
Hi @Den4ik, here is your new Magento instance. |
|
@sivaschenko Thanks for your answers. I have refactored my previous solution implementation |
sivaschenko
left a comment
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 @Den4ik thanks for the update! Please take a look at my code review notes.
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.
Please add new constructor parameters in a backward compatible way: as a last optional parameter.
See more details in Backward compatible development guide "Adding Constructor parameters" section.
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.
Fixed
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.
Is that suppress warning necessary here? I don't see too many dependencies in this class.
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.
You were right. Comment was removed
|
Hi @sivaschenko Thanks you for fast review. I have update the code according to your recommendations |
|
@p-bystritsky how d52a446 landed here? |
6ae319f to
9e491a6
Compare
…ew-summary-for-produc-list
df572e2 to
452a55c
Compare
452a55c to
66084b2
Compare
66084b2 to
f4fce7b
Compare
|
Hi @Den4ik, thank you for your contribution! |
|
@dvynograd here is something to learn for you 😉 |
| if ($this->_totalRecords === null) { | ||
| $sql = $this->getSelectCountSql(); | ||
| $this->_totalRecords = $this->getConnection()->fetchOne($sql, $this->_bindParams); | ||
| $this->_totalRecords = $this->_totalRecords ?? $this->getConnection()->fetchOne($sql, $this->_bindParams); |
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.
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.
@korostii Null coalescence check won't broke anything in this case, but looks strange :)
@p-bystritsky Do you remember what static tests you were fixed by this code?
Description (*)
Module observers executed after
CatalogBlockProductCollectionBeforeToHtmlObserverdon't have affect on collection. This PR is changing Review observer logic. If fact we can join only 2 reviews_count and rating_summary fields instead of send additional sql query for retrieving this data.Fixed Issues (if relevant)
Changed append summary to product collection to mysql join
load()of product collection inReviewobserver as it causes issues for other observers community-features#57: DO NOT doload()of product collection inReviewobserver as it causes issues for other observersManual testing scenarios (*)
catalog_block_product_list_collectionContribution checklist (*)