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

Fix addIdFilter method #9400

Merged
merged 1 commit into from
Apr 30, 2017

Conversation

adrian-martinez-interactiv4
Copy link
Contributor

@adrian-martinez-interactiv4 adrian-martinez-interactiv4 commented Apr 25, 2017

Description

Application breaks when \Magento\Catalog\Model\ResourceModel\Category\Flat::getCategories is called, with $toLoad == false (so collection is not loaded yet, as it is called indirectly at magento/module-catalog-event/Block/Event/Lister.php:108: $categories = $this->_categoryHelper->getStoreCategories('position', true, false);), then \Magento\Catalog\Model\ResourceModel\Category\Flat\Collection::addIdFilter is called for the unloaded collection (as in magento/module-catalog-event/Block/Event/Lister.php:125: $categories->addIdFilter($eventCollection->getColumnValues('category_id'));), and then it tries to load the collection.

It breaks due to ambiguous 'entity_id' field in where clause; field with such name is both found within catalog_category_flat_store_% and url_rewrite tables.

Manual testing scenarios

  • Category flat tables are enabled.
  • Use \Magento\CatalogEvent\Block\Event\Lister or \Magento\CatalogEvent\Block\Widget\Lister, directly or via directive in cms page / block, or
  • Create a new category collection, then call addUrlRewriteToResult() and addIdFilter($categoryIds) methods, and try to load the collection

Issues related

#7523

Use case:
- Category flat tables are enabled.
- Use \Magento\CatalogEvent\Block\Event\Lister or \Magento\CatalogEvent\Block\Widget\Lister, directly or via directive in cms page / block;

Application breaks when \Magento\Catalog\Model\ResourceModel\Category\Flat::getCategories is called, with $toLoad == false (so collection is not loaded yet, as it is called indirectly at magento/module-catalog-event/Block/Event/Lister.php:108: $categories = $this->_categoryHelper->getStoreCategories('position', true, false);), then \Magento\Catalog\Model\ResourceModel\Category\Flat\Collection::addIdFilter is called for the unloaded collection (as in magento/module-catalog-event/Block/Event/Lister.php:125: $categories->addIdFilter($eventCollection->getColumnValues('category_id'));), and then it tries to load the collection.

It breaks due to ambiguous 'entity_id' field in where clause; field with such name is both found within catalog_category_flat_store_% and url_rewrite tables.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Apr 25, 2017

CLA assistant check
All committers have signed the CLA.

@ishakhsuvarov ishakhsuvarov self-assigned this Apr 27, 2017
@ishakhsuvarov ishakhsuvarov added this to the April 2017 milestone Apr 27, 2017
@magento-team magento-team merged commit dc4b5f8 into magento:develop Apr 30, 2017
magento-team pushed a commit that referenced this pull request Apr 30, 2017
magento-team pushed a commit that referenced this pull request Apr 30, 2017
[EngCom] Public Pull Requests

 - MAGETWO-67723: Add logging to contact us form #9343
 - MAGETWO-67721: Remove context aggregation validation (see Issue #6114) #8955
 - MAGETWO-68767: Use loadPlayer requirejs mapping #9414
 - MAGETWO-68770: Fix addIdFilter method #9400
@magento-team
Copy link
Contributor

@adrian-martinez-interactiv4 thank you for your contribution to Magento 2 project

@adrian-martinez-interactiv4 adrian-martinez-interactiv4 deleted the patch-1 branch May 9, 2017 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants