I'm aware that Magento 2 introduced data models as part of the service contract architecture. Data models usually implement interfaces defined in Api/Data/ of a module.
But, Magento seems to have retained the old models too.
Let's take an example to module-customer.
- Data model interface defined in Api/Data/CustomerInterface.php
- The above interface is implemented in Model/Data/Customer.php
- The data model has all the getter and setter function for the customer variables, as one would expect
- In addition to the above there is also a Model/Customer.php. This too has getter and setter function. This is more like a Magento 1 model that connects to the ResourceModel (Model/ResourceModel/Customer.php)
- In Model/ResourceModel/CustomerRepository.php, various function collect data from the Magnento 1 model, transfer them to the data model, and then return the data model.
Why does one need the old model? Why can't the data model directly connect with the ResourceModel?