Video Lesson: Create a repository interface in Magento

Create a repository interface in Magento

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

Create a repository interface in Magento

Learn how to create a Magento PostRepositoryInterface with save getById deleteById CRUD methods and Swagger ready docblocks.

Lesson Content

We now want to create an interface that our repository can implement. Remember that repository interfaces lay out a public API that is dependable and that others can rely on. It’s completely up to you what you define in your repository interface — you can define 1 function in this interface, or 100! It’s completely up to you.

It is standard convention to define at least save and getById functions. Again, we don’t have to create these! But it is also good to follow conventions, and names that others expect to see.

Our data interfaces will go into the Api directory. This signals that...

Premium content

Enroll to unlock the full content and all course materials.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.