Log in
Model

CategoryRepository

Magento\Catalog\Model\CategoryRepository

What it does

This repository class provides a centralized interface for managing Magento 2 categories through CRUD operations (create, read, update, delete).

Developers use this class when they need to programmatically save, retrieve, or delete categories while ensuring proper data validation, caching, and store context handling.

It's the recommended way to interact with category data instead of directly using models or resource models.

Public Methods

  • save()
  • get()
  • delete()
  • deleteByIdentifier()
  • _resetState()