What methods is a repository required to implement?

The documentation (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/service-contracts/design-patterns.html) states that you need to implement save(), get(), getList(), delete() and deleteById(). But I often see example in Magento core that use different variations such as getById() instead of just get(). Or use completely different methods.

Is there a standard? Any tutorials that could be recommended?


You know all there is to know

save(), get(), getList(), delete(), deleteById()

Remember these are simply php classes and like any other can be customised to suit your needs

But generally if you start with those you know that your code is consistent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.