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
EntityManager
over 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?