Log in
Collection

AbstractCollection

Magento\Catalog\Model\ResourceModel\AbstractCollection

What it does

This abstract collection class serves as a base for Magento 2 catalog collections, providing backward compatibility between EAV (Entity-Attribute-Value) and flat table structures.

Developers extend this class when creating custom product or category collections, allowing them to use familiar EAV-style methods like addAttributeToSelect, addAttributeToFilter, and addAttributeToSort even when working with flat tables.

It also implements SearchCriteriaInterface for API-based collection operations.

Public Methods

  • setSelectCountSql()
  • getSelectCountSql()
  • addAttributeToSelect()
  • addAttributeToFilter()
  • addAttributeToSort()
  • setPage()
  • getAllIds()
  • getSearchCriteria()
  • setSearchCriteria()
  • getTotalCount()
  • setTotalCount()
  • setItems()