Deprecated save and load methods in Abstract Model












49















I see that in the develop branch of the Magento 2 repo the methods load and save from MagentoFrameworkModelAbstractModel class are deprecated.

But there are a gazillion classes in the core that extend this class and use save and load.

When creating my own module for the CRUD part of my entities I follow the same guidelines as a core module does.

But since these methods are deprecated I would rather be prepared for the future.

What should I use instead of them? Or I should extend something else?










share|improve this question

























  • Are these methods are deprecated now?

    – Knight017
    Jan 18 at 9:43






  • 1





    If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

    – Marius
    Jan 18 at 10:00
















49















I see that in the develop branch of the Magento 2 repo the methods load and save from MagentoFrameworkModelAbstractModel class are deprecated.

But there are a gazillion classes in the core that extend this class and use save and load.

When creating my own module for the CRUD part of my entities I follow the same guidelines as a core module does.

But since these methods are deprecated I would rather be prepared for the future.

What should I use instead of them? Or I should extend something else?










share|improve this question

























  • Are these methods are deprecated now?

    – Knight017
    Jan 18 at 9:43






  • 1





    If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

    – Marius
    Jan 18 at 10:00














49












49








49


13






I see that in the develop branch of the Magento 2 repo the methods load and save from MagentoFrameworkModelAbstractModel class are deprecated.

But there are a gazillion classes in the core that extend this class and use save and load.

When creating my own module for the CRUD part of my entities I follow the same guidelines as a core module does.

But since these methods are deprecated I would rather be prepared for the future.

What should I use instead of them? Or I should extend something else?










share|improve this question
















I see that in the develop branch of the Magento 2 repo the methods load and save from MagentoFrameworkModelAbstractModel class are deprecated.

But there are a gazillion classes in the core that extend this class and use save and load.

When creating my own module for the CRUD part of my entities I follow the same guidelines as a core module does.

But since these methods are deprecated I would rather be prepared for the future.

What should I use instead of them? Or I should extend something else?







magento2 model magento-2.0 magento-2.0.5 deprecated






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 23 '18 at 9:12







Marius

















asked May 11 '16 at 14:01









MariusMarius

166k28317680




166k28317680













  • Are these methods are deprecated now?

    – Knight017
    Jan 18 at 9:43






  • 1





    If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

    – Marius
    Jan 18 at 10:00



















  • Are these methods are deprecated now?

    – Knight017
    Jan 18 at 9:43






  • 1





    If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

    – Marius
    Jan 18 at 10:00

















Are these methods are deprecated now?

– Knight017
Jan 18 at 9:43





Are these methods are deprecated now?

– Knight017
Jan 18 at 9:43




1




1





If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

– Marius
Jan 18 at 10:00





If, by now you mean 2.3, yes they are: github.com/magento/magento2/blob/2.3/lib/internal/Magento/…

– Marius
Jan 18 at 10:00










3 Answers
3






active

oldest

votes


















26














You should use Module Service Contract.



For example for product you should use ProductRepositoryInterface



If Module Service Contract is not available you can use ResourceModel to save entities.






share|improve this answer


























  • I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

    – Marius
    May 12 '16 at 6:10






  • 1





    I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

    – Marius
    May 12 '16 at 9:05






  • 2





    yes, for your module better to use ResourceModel in your Module SL

    – KAndy
    May 12 '16 at 10:39






  • 5





    can you please give some example code for how we can use ResourceModel

    – Yogesh Karodiya
    Nov 8 '16 at 9:45






  • 1





    Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

    – Jānis Elmeris
    Nov 15 '17 at 15:38



















24














From what I understood, what is going to happen is Magento is going to switch to hydrators with extract() and hydrate() methods.



This link used to work but it seems like Magento team rolled it back: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Model/Entity/EntityHydrator.php



You can find the history of the commit here though: https://github.com/magento/magento2/tree/09132da06e18dde0f90aabfc962db2bc19b64f3c/lib/internal/Magento/Framework/Model/Entity



The important files are:




  • EntityHydrator.php

  • EntityMetadata.php

  • HydratorInterface.php

  • MetadataPool.php


I also suggest you check out the files under the Action folder as well as the Sequence files.



From what I understood (I may be totally wrong here):




  • the files under the Action folder are CRUD actions

  • the Sequence files are iterators ?


That was a conversation that happened a while ago (was it Alan Storm who mentionned it ? can't remember) so I'm not sure if Magento team is still going that way.



Update



From my research, the internal Magento ticket regarding this change is MAGETWO-50676, here are the related commits I managed to find:




  • https://github.com/magento/magento2/commit/d57c81ced2419cde9d8af2f55062a783ec6a7789

  • https://github.com/magento/magento2/commit/35d2da47a20e978c1cb970db79ee4ea60de56353

  • https://github.com/magento/magento2/commit/074b3abc6803454542ff0527110e575309c42466


There's probably more TBH but I don't feel like browsing the entire repo for commit messages ^^



If you're not familiar with hydrators, I suggest you check that link out: http://www.webconsults.eu/blog/entry/108-What_is_a_Hydrator_in_Zend_Framework_2



Update from 2.1



Magento is now using the EntityManager class to replace the inheritance you can find more information here: Magento 2.1: using the entity manager






share|improve this answer





















  • 1





    Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

    – Marius
    May 11 '16 at 14:14











  • @Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

    – Raphael at Digital Pianism
    May 11 '16 at 14:16






  • 4





    you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

    – David Verholen
    May 17 '16 at 19:23



















4














See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626






share|improve this answer





















  • 1





    Any idea when load save and delete are going to go away?

    – Marius
    Jun 22 '17 at 6:02






  • 1





    They will stay for 2-3 minor releases

    – Anton Kril
    Jun 24 '17 at 19:53











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114929%2fdeprecated-save-and-load-methods-in-abstract-model%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









26














You should use Module Service Contract.



For example for product you should use ProductRepositoryInterface



If Module Service Contract is not available you can use ResourceModel to save entities.






share|improve this answer


























  • I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

    – Marius
    May 12 '16 at 6:10






  • 1





    I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

    – Marius
    May 12 '16 at 9:05






  • 2





    yes, for your module better to use ResourceModel in your Module SL

    – KAndy
    May 12 '16 at 10:39






  • 5





    can you please give some example code for how we can use ResourceModel

    – Yogesh Karodiya
    Nov 8 '16 at 9:45






  • 1





    Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

    – Jānis Elmeris
    Nov 15 '17 at 15:38
















26














You should use Module Service Contract.



For example for product you should use ProductRepositoryInterface



If Module Service Contract is not available you can use ResourceModel to save entities.






share|improve this answer


























  • I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

    – Marius
    May 12 '16 at 6:10






  • 1





    I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

    – Marius
    May 12 '16 at 9:05






  • 2





    yes, for your module better to use ResourceModel in your Module SL

    – KAndy
    May 12 '16 at 10:39






  • 5





    can you please give some example code for how we can use ResourceModel

    – Yogesh Karodiya
    Nov 8 '16 at 9:45






  • 1





    Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

    – Jānis Elmeris
    Nov 15 '17 at 15:38














26












26








26







You should use Module Service Contract.



For example for product you should use ProductRepositoryInterface



If Module Service Contract is not available you can use ResourceModel to save entities.






share|improve this answer















You should use Module Service Contract.



For example for product you should use ProductRepositoryInterface



If Module Service Contract is not available you can use ResourceModel to save entities.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 17 '18 at 11:50

























answered May 11 '16 at 17:40









KAndyKAndy

15.9k23044




15.9k23044













  • I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

    – Marius
    May 12 '16 at 6:10






  • 1





    I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

    – Marius
    May 12 '16 at 9:05






  • 2





    yes, for your module better to use ResourceModel in your Module SL

    – KAndy
    May 12 '16 at 10:39






  • 5





    can you please give some example code for how we can use ResourceModel

    – Yogesh Karodiya
    Nov 8 '16 at 9:45






  • 1





    Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

    – Jānis Elmeris
    Nov 15 '17 at 15:38



















  • I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

    – Marius
    May 12 '16 at 6:10






  • 1





    I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

    – Marius
    May 12 '16 at 9:05






  • 2





    yes, for your module better to use ResourceModel in your Module SL

    – KAndy
    May 12 '16 at 10:39






  • 5





    can you please give some example code for how we can use ResourceModel

    – Yogesh Karodiya
    Nov 8 '16 at 9:45






  • 1





    Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

    – Jānis Elmeris
    Nov 15 '17 at 15:38

















I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

– Marius
May 12 '16 at 6:10





I see. This makes sense. But can you confirm that all the core CRUD modules will have service contracts at one point?

– Marius
May 12 '16 at 6:10




1




1





I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

– Marius
May 12 '16 at 9:05





I see that the implementation of ProductRepositoryInterface still uses load in the methods get and getById. Should I use the resource model for my module instead of this load method?

– Marius
May 12 '16 at 9:05




2




2





yes, for your module better to use ResourceModel in your Module SL

– KAndy
May 12 '16 at 10:39





yes, for your module better to use ResourceModel in your Module SL

– KAndy
May 12 '16 at 10:39




5




5





can you please give some example code for how we can use ResourceModel

– Yogesh Karodiya
Nov 8 '16 at 9:45





can you please give some example code for how we can use ResourceModel

– Yogesh Karodiya
Nov 8 '16 at 9:45




1




1





Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

– Jānis Elmeris
Nov 15 '17 at 15:38





Do you have any examples? I looked at the official review and newsletter modules, and they are calling "save" directly. I cannot find an example of using ResourceModel. I have it defined for my module, but how to use it?

– Jānis Elmeris
Nov 15 '17 at 15:38













24














From what I understood, what is going to happen is Magento is going to switch to hydrators with extract() and hydrate() methods.



This link used to work but it seems like Magento team rolled it back: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Model/Entity/EntityHydrator.php



You can find the history of the commit here though: https://github.com/magento/magento2/tree/09132da06e18dde0f90aabfc962db2bc19b64f3c/lib/internal/Magento/Framework/Model/Entity



The important files are:




  • EntityHydrator.php

  • EntityMetadata.php

  • HydratorInterface.php

  • MetadataPool.php


I also suggest you check out the files under the Action folder as well as the Sequence files.



From what I understood (I may be totally wrong here):




  • the files under the Action folder are CRUD actions

  • the Sequence files are iterators ?


That was a conversation that happened a while ago (was it Alan Storm who mentionned it ? can't remember) so I'm not sure if Magento team is still going that way.



Update



From my research, the internal Magento ticket regarding this change is MAGETWO-50676, here are the related commits I managed to find:




  • https://github.com/magento/magento2/commit/d57c81ced2419cde9d8af2f55062a783ec6a7789

  • https://github.com/magento/magento2/commit/35d2da47a20e978c1cb970db79ee4ea60de56353

  • https://github.com/magento/magento2/commit/074b3abc6803454542ff0527110e575309c42466


There's probably more TBH but I don't feel like browsing the entire repo for commit messages ^^



If you're not familiar with hydrators, I suggest you check that link out: http://www.webconsults.eu/blog/entry/108-What_is_a_Hydrator_in_Zend_Framework_2



Update from 2.1



Magento is now using the EntityManager class to replace the inheritance you can find more information here: Magento 2.1: using the entity manager






share|improve this answer





















  • 1





    Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

    – Marius
    May 11 '16 at 14:14











  • @Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

    – Raphael at Digital Pianism
    May 11 '16 at 14:16






  • 4





    you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

    – David Verholen
    May 17 '16 at 19:23
















24














From what I understood, what is going to happen is Magento is going to switch to hydrators with extract() and hydrate() methods.



This link used to work but it seems like Magento team rolled it back: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Model/Entity/EntityHydrator.php



You can find the history of the commit here though: https://github.com/magento/magento2/tree/09132da06e18dde0f90aabfc962db2bc19b64f3c/lib/internal/Magento/Framework/Model/Entity



The important files are:




  • EntityHydrator.php

  • EntityMetadata.php

  • HydratorInterface.php

  • MetadataPool.php


I also suggest you check out the files under the Action folder as well as the Sequence files.



From what I understood (I may be totally wrong here):




  • the files under the Action folder are CRUD actions

  • the Sequence files are iterators ?


That was a conversation that happened a while ago (was it Alan Storm who mentionned it ? can't remember) so I'm not sure if Magento team is still going that way.



Update



From my research, the internal Magento ticket regarding this change is MAGETWO-50676, here are the related commits I managed to find:




  • https://github.com/magento/magento2/commit/d57c81ced2419cde9d8af2f55062a783ec6a7789

  • https://github.com/magento/magento2/commit/35d2da47a20e978c1cb970db79ee4ea60de56353

  • https://github.com/magento/magento2/commit/074b3abc6803454542ff0527110e575309c42466


There's probably more TBH but I don't feel like browsing the entire repo for commit messages ^^



If you're not familiar with hydrators, I suggest you check that link out: http://www.webconsults.eu/blog/entry/108-What_is_a_Hydrator_in_Zend_Framework_2



Update from 2.1



Magento is now using the EntityManager class to replace the inheritance you can find more information here: Magento 2.1: using the entity manager






share|improve this answer





















  • 1





    Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

    – Marius
    May 11 '16 at 14:14











  • @Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

    – Raphael at Digital Pianism
    May 11 '16 at 14:16






  • 4





    you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

    – David Verholen
    May 17 '16 at 19:23














24












24








24







From what I understood, what is going to happen is Magento is going to switch to hydrators with extract() and hydrate() methods.



This link used to work but it seems like Magento team rolled it back: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Model/Entity/EntityHydrator.php



You can find the history of the commit here though: https://github.com/magento/magento2/tree/09132da06e18dde0f90aabfc962db2bc19b64f3c/lib/internal/Magento/Framework/Model/Entity



The important files are:




  • EntityHydrator.php

  • EntityMetadata.php

  • HydratorInterface.php

  • MetadataPool.php


I also suggest you check out the files under the Action folder as well as the Sequence files.



From what I understood (I may be totally wrong here):




  • the files under the Action folder are CRUD actions

  • the Sequence files are iterators ?


That was a conversation that happened a while ago (was it Alan Storm who mentionned it ? can't remember) so I'm not sure if Magento team is still going that way.



Update



From my research, the internal Magento ticket regarding this change is MAGETWO-50676, here are the related commits I managed to find:




  • https://github.com/magento/magento2/commit/d57c81ced2419cde9d8af2f55062a783ec6a7789

  • https://github.com/magento/magento2/commit/35d2da47a20e978c1cb970db79ee4ea60de56353

  • https://github.com/magento/magento2/commit/074b3abc6803454542ff0527110e575309c42466


There's probably more TBH but I don't feel like browsing the entire repo for commit messages ^^



If you're not familiar with hydrators, I suggest you check that link out: http://www.webconsults.eu/blog/entry/108-What_is_a_Hydrator_in_Zend_Framework_2



Update from 2.1



Magento is now using the EntityManager class to replace the inheritance you can find more information here: Magento 2.1: using the entity manager






share|improve this answer















From what I understood, what is going to happen is Magento is going to switch to hydrators with extract() and hydrate() methods.



This link used to work but it seems like Magento team rolled it back: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Model/Entity/EntityHydrator.php



You can find the history of the commit here though: https://github.com/magento/magento2/tree/09132da06e18dde0f90aabfc962db2bc19b64f3c/lib/internal/Magento/Framework/Model/Entity



The important files are:




  • EntityHydrator.php

  • EntityMetadata.php

  • HydratorInterface.php

  • MetadataPool.php


I also suggest you check out the files under the Action folder as well as the Sequence files.



From what I understood (I may be totally wrong here):




  • the files under the Action folder are CRUD actions

  • the Sequence files are iterators ?


That was a conversation that happened a while ago (was it Alan Storm who mentionned it ? can't remember) so I'm not sure if Magento team is still going that way.



Update



From my research, the internal Magento ticket regarding this change is MAGETWO-50676, here are the related commits I managed to find:




  • https://github.com/magento/magento2/commit/d57c81ced2419cde9d8af2f55062a783ec6a7789

  • https://github.com/magento/magento2/commit/35d2da47a20e978c1cb970db79ee4ea60de56353

  • https://github.com/magento/magento2/commit/074b3abc6803454542ff0527110e575309c42466


There's probably more TBH but I don't feel like browsing the entire repo for commit messages ^^



If you're not familiar with hydrators, I suggest you check that link out: http://www.webconsults.eu/blog/entry/108-What_is_a_Hydrator_in_Zend_Framework_2



Update from 2.1



Magento is now using the EntityManager class to replace the inheritance you can find more information here: Magento 2.1: using the entity manager







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 13 '17 at 12:54









Community

1




1










answered May 11 '16 at 14:10









Raphael at Digital PianismRaphael at Digital Pianism

54.5k22118276




54.5k22118276








  • 1





    Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

    – Marius
    May 11 '16 at 14:14











  • @Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

    – Raphael at Digital Pianism
    May 11 '16 at 14:16






  • 4





    you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

    – David Verholen
    May 17 '16 at 19:23














  • 1





    Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

    – Marius
    May 11 '16 at 14:14











  • @Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

    – Raphael at Digital Pianism
    May 11 '16 at 14:16






  • 4





    you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

    – David Verholen
    May 17 '16 at 19:23








1




1





Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

– Marius
May 11 '16 at 14:14





Ok. Nice theory. But I could use an example from the core. I'm sorry, but my magento skills resume to copy/paste/replace :). You mentioned Action and Sequence files. Can you be more specific?

– Marius
May 11 '16 at 14:14













@Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

– Raphael at Digital Pianism
May 11 '16 at 14:16





@Marius unfortunately that's all I know. I can't remember where I got that info from but the plan at that time was to use this particular commit: github.com/magento/magento2/tree/… to implement the switch from load()/save() to hydrators. I assume Sequences work like iterators and Actions are CRUD actions

– Raphael at Digital Pianism
May 11 '16 at 14:16




4




4





you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

– David Verholen
May 17 '16 at 19:23





you find an example in the current cms block resource model load method: github.com/magento/magento2/blob/develop/app/code/Magento/Cms/… It uses the entityManager->load github.com/magento/magento2/blob/develop/lib/internal/Magento/… which executes a ReadMain operation (I think) github.com/magento/magento2/blob/develop/lib/internal/Magento/… which hydrates the skeleton entity with the loaded entity data (nice move from Magento ;))

– David Verholen
May 17 '16 at 19:23











4














See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626






share|improve this answer





















  • 1





    Any idea when load save and delete are going to go away?

    – Marius
    Jun 22 '17 at 6:02






  • 1





    They will stay for 2-3 minor releases

    – Anton Kril
    Jun 24 '17 at 19:53
















4














See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626






share|improve this answer





















  • 1





    Any idea when load save and delete are going to go away?

    – Marius
    Jun 22 '17 at 6:02






  • 1





    They will stay for 2-3 minor releases

    – Anton Kril
    Jun 24 '17 at 19:53














4












4








4







See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626






share|improve this answer















See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626







share|improve this answer














share|improve this answer



share|improve this answer








edited 9 mins ago









Marius

166k28317680




166k28317680










answered Jun 22 '17 at 4:46









Anton KrilAnton Kril

3,9761321




3,9761321








  • 1





    Any idea when load save and delete are going to go away?

    – Marius
    Jun 22 '17 at 6:02






  • 1





    They will stay for 2-3 minor releases

    – Anton Kril
    Jun 24 '17 at 19:53














  • 1





    Any idea when load save and delete are going to go away?

    – Marius
    Jun 22 '17 at 6:02






  • 1





    They will stay for 2-3 minor releases

    – Anton Kril
    Jun 24 '17 at 19:53








1




1





Any idea when load save and delete are going to go away?

– Marius
Jun 22 '17 at 6:02





Any idea when load save and delete are going to go away?

– Marius
Jun 22 '17 at 6:02




1




1





They will stay for 2-3 minor releases

– Anton Kril
Jun 24 '17 at 19:53





They will stay for 2-3 minor releases

– Anton Kril
Jun 24 '17 at 19:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114929%2fdeprecated-save-and-load-methods-in-abstract-model%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What other Star Trek series did the main TNG cast show up in?

Berlina muro

Berlina aerponto