Log in
Model

ToDataModel

Magento\SalesRule\Model\Converter\ToDataModel

What it does

This converter class transforms Magento SalesRule model objects (database entities) into their corresponding Data Transfer Objects (DTOs) that are used in the API layer.

Developers use this when they need to expose sales rule data through Magento's API, as it handles the conversion of serialized conditions, store labels, and coupon types into properly structured API-compatible objects.

Public Methods

  • toDataModel()
  • arrayToConditionDataModel()