Deprecated save and load methods in Abstract ModelMagento 2 : The proper way to read/save entitiesHow to...
Caulking a corner instead of taping with joint compound?
How to disable or uninstall iTunes under High Sierra without disabling SIP
Has Wakanda ever accepted refugees?
Split a number into equal parts given the number of parts
Are small insurances worth it
When was drinking water recognized as crucial in marathon running?
I can't die. Who am I?
Correct physics behind the colors on CD (compact disc)?
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
Should we avoid writing fiction about historical events without extensive research?
PTIJ: Why can't I sing about soda on certain days?
Meaning of word ягоза
How do you say “my friend is throwing a party, do you wanna come?” in german
GPL code private and stolen
The need of reserving one's ability in job interviews
Is there a frame of reference in which I was born before I was conceived?
When to use mean vs median
If nine coins are tossed, what is the probability that the number of heads is even?
Can the Shape Water Cantrip be used to manipulate blood?
Is there a full canon version of Tyrion's jackass/honeycomb joke?
Is there a way to find out the age of climbing ropes?
Deal the cards to the players
Draw bounding region by list of points
Plagiarism of code by other PhD student
Deprecated save and load methods in Abstract Model
Magento 2 : The proper way to read/save entitiesHow to implement service contract for a custom module in Magento 2?Magento 2.1.1 How to load Order with Increment ID using OrderRepository objectMagento 2 - Why is MagentoCheckoutModelCart deprecated?Magento 2 : How to load quote by quote idBest Way to Load a Custom Model in Magento 2Magento 2.1: using the entity managerMagento2 : Best way to load Customer by customer IdMagento 2 - Create product programmatically with different store view valuesprogramatically cancel the order using order id - Magento 2what is paygate folder in magento core payment module?Injecting Dependencies into a Magento 2 CRUD/Abstract ModelAbstract Resource Model classesHow to implement service contract for a custom module in Magento 2?Constructor integrity testsMagento 2 : The proper way to read/save entitiesBest Way to Load a Custom Model in Magento 2What is the proper way of implementing service contracts in Magento 2?What and why is the proper way to load a modelCorrect way to save entries to database
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
add a comment |
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
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
add a comment |
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
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
magento2 model magento-2.0 magento-2.0.5 deprecated
edited Oct 23 '18 at 9:12
Marius
asked May 11 '16 at 14:01
Marius♦Marius
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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.
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 ofProductRepositoryInterface
still usesload
in the methodsget
andgetById
. Should I use the resource model for my module instead of thisload
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
|
show 4 more comments
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
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 fromload()/save()
to hydrators. I assumeSequences
work like iterators andActions
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
add a comment |
See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626
1
Any idea whenload
save
anddelete
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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 ofProductRepositoryInterface
still usesload
in the methodsget
andgetById
. Should I use the resource model for my module instead of thisload
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
|
show 4 more comments
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.
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 ofProductRepositoryInterface
still usesload
in the methodsget
andgetById
. Should I use the resource model for my module instead of thisload
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
|
show 4 more comments
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.
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.
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 ofProductRepositoryInterface
still usesload
in the methodsget
andgetById
. Should I use the resource model for my module instead of thisload
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
|
show 4 more comments
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 ofProductRepositoryInterface
still usesload
in the methodsget
andgetById
. Should I use the resource model for my module instead of thisload
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
|
show 4 more comments
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
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 fromload()/save()
to hydrators. I assumeSequences
work like iterators andActions
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
add a comment |
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
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 fromload()/save()
to hydrators. I assumeSequences
work like iterators andActions
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
add a comment |
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
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
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 fromload()/save()
to hydrators. I assumeSequences
work like iterators andActions
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
add a comment |
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 fromload()/save()
to hydrators. I assumeSequences
work like iterators andActions
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
add a comment |
See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626
1
Any idea whenload
save
anddelete
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
add a comment |
See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626
1
Any idea whenload
save
anddelete
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
add a comment |
See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626
See description in the class code https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Model/AbstractModel.php#L626
edited 5 mins ago
Marius♦
166k28317680
166k28317680
answered Jun 22 '17 at 4:46
Anton KrilAnton Kril
3,9761321
3,9761321
1
Any idea whenload
save
anddelete
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
add a comment |
1
Any idea whenload
save
anddelete
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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