This question already has an answer here:
I have a complex web application that manages stores and their customers.
The application follows a basic MVC architecture and I should migrate it to a multi-tenant application: - I should go from one store to more stores belonging the same company
I will have a db for each store (one db with tenant_id is not an option)
I would like to keep the existing interfaces, for example customer.getOrders(). But now "customer" must search on several stores/db. This would allow me keep most of the logic and presentation
It's not clear to me how what is the best pattern from an OOP point of view.
Should I have for example an interface Customer and then 2 implementations, CustomerSingle (the existing one) and CustomerMulti that contains a collection of CustomerSingle? Is there a known software pattern for this situation?
In other words, all the original classes will be still valid in the multi tenant situation but I must "aggregate" their result.