Model

StockRepository

Magento\CatalogInventory\Model\Stock\StockRepository

What it does

This repository class manages CRUD operations for inventory stock entities in Magento 2.

Developers use it to save, retrieve, list, and delete stock records programmatically, providing a standardized interface for stock data persistence.

It handles database operations through the stock resource model and includes proper exception handling for error cases.

Public Methods

  • save()
  • get()
  • getList()
  • delete()
  • deleteById()