From 2.1 Magento has introduced Magento/Framework/Model/EntityManager
I may be wrong here but from my understanding it is to replace Magento/Framework/Model/AbstractModel which was implementing the feature via inheritance and solve this via composition (FYI : https://en.m.wikipedia.org/wiki/Composition_over_inheritance )
You can get an example here in the core files: https://github.com/magento/magento2/blob/59671558ecdab652b40db2d1a7c63d5b1dea0a92/app/code/Magento/Cms/Model/ResourceModel/Block.php
Basically all the CRUD operations are explicitly declared in the class and deferred to the EntityManager class. Before 2.1, the parent method was called via inheritance.
So my questions are:
- what are the benefits of the
EntityManagerover the pre 2.1 inheritance system? - is simply declaring the CRUD methods (like the example above) enough to start implementing it in a custom CRUD module or is there more?
-
1Not an answer - but I would hazard one of the benefits of using an EntityManager would be the ability for a possible injection of a Repository type system - where loading might happen in-memory rather than hitting the DB if the entity had already been pulled into memory, etc.Navarr– Navarr2016年07月25日 17:04:27 +00:00Commented Jul 25, 2016 at 17:04
1 Answer 1
Currently, we do not recommend to use EntityManager for your entities as it's an unfinished feature and we plan to make configuration more declarative.
Ideas of EntityManager are:
- allow persist Data Entity by the interface (no need to extends from abstract classes)
- make persistent explicit extensible
- modularity
-
Thanks for that could you add to your answer the reason why you do not recommend using it ? (Unfinished feature, buggy, other?)Raphael at Digital Pianism– Raphael at Digital Pianism2016年07月25日 18:37:56 +00:00Commented Jul 25, 2016 at 18:37
-
1Yes, unfinished futures, we plan to make configuration more declarativeKAndy– KAndy2016年07月26日 07:11:52 +00:00Commented Jul 26, 2016 at 7:11
-
6Moar XMLs, MOAR! :)nevvermind– nevvermind2016年07月26日 17:35:00 +00:00Commented Jul 26, 2016 at 17:35
-
Could we know what is the expected date they will finish this unfinished futures?Toan Nguyen– Toan Nguyen2016年08月12日 09:04:40 +00:00Commented Aug 12, 2016 at 9:04
-
3Because Magento backlog directly affected by community and partners feedback any task can be prioritized and deprioritized and no one know when concrete task will be finished, before it's done and published.KAndy– KAndy2016年08月12日 09:39:01 +00:00Commented Aug 12, 2016 at 9:39
Explore related questions
See similar questions with these tags.