Create a data transfer object (DTO) interface in Magento
Learn how to create a Magento DTO PostInterface with getters setters for REST API ready blog post data.
Lesson Content
A repository is that last level of abstraction that lays over models, resource models & collections. But before we define our repository, we’ll first define the interface it will abide by. And to top it off... our repository will depend on another interface for our data transfer object, or DTO.
The DTO is responsible for representing the specific object & fields which we want to get & save data for. You can think of this as an interface-representation of an entity object.
Create a DTO class
Let’s create a new directory under our module root named Api, which signals we are now in...
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.