Magento 2 Deprecated Save & Load Methods In Abstract Model

- Fire development, Magento 2

Magento 2 Development; Magento 2 tutorial

You might have already seen that the develop branch of the Magento 2 repo contains load and save methods from Magento\Framework\Model\AbstractModel that are deprecated. If you follow the guidelines that the core module does, you may face a problem: it is necessary to use something instead of them or extend something else. Below, we provide the solution.

The most obvious solution is to use Module Service Contract – ProductRepositoryInterface for products. Alternatively, you can save entities via ResourceModel if Module Service Contract is unavailable.

From 2.1, Magento is using the EntityManager class to replace the inheritance. For further information, follow this link Magento 2.1 entity manager.

We hope this post was useful. It is based on the StackExchange question by Marius and answers by KAndy and Raphael at Digital Pianism. For more useful articles, check out our Cookbook.