Hi guys. Since that https://github.com/magento/magento2/commit/02b9213e4468bfa765ecc38ee55657662554fd72 commit AbstractModel->save() method is deprecated. Please someone tell me, what i should use for save it ?
For now, you should use ResourceModel->save(). Entity should not have persistence operations, so this method was deprecated.
Big thanks.
Entity should not have persistence operations, so this method was deprecated.
I agree but this could have been realized before...
Is there an example anywhere of how to actually use ResourceModel?
Here is the example for save: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Catalog/Model/ProductRepository.php#L609
@jreinke, the approach with persistence on models was implemented 10 years ago.
Still, your example uses "load" which also is deprecated: https://github.com/magento/magento2/blob/2.2.0/app/code/Magento/Catalog/Model/ProductRepository.php#L271
Thanks for the example! I was looking at the (hopefully simpler) newsletter and review module cases, but they used the deprecated approach.
Still, your example uses "load" which also is deprecated: https://github.com/magento/magento2/blob/2.2.0/app/code/Magento/Catalog/Model/ProductRepository.php#L271