Log in
Model

GetCategories

Magento\Catalog\Model\ResourceModel\Product\GetCategories

What it does

This class retrieves all category IDs associated with a given list of products across all store views in Magento 2.

Developers would use this when they need to determine which categories contain specific products, such as for cache invalidation, product relations, or category-based operations.

It queries the category-product index tables to efficiently fetch this relationship data.

Public Methods

  • execute()