So I have a class for instance called foo and have two ways of storing data either in mongo or mysql.
at the moment I have something like
namespace vendor;
use bar;
use bar\mysql;
class foo extends bar\mongo {
}
now is there a better way to do it ? I know there is I just don’t know which pattern it is if any.
The principle that can be applied is called:
That means in stead of inheriting from those objects, you give the class instances of those objects, and then does operations on it.
For example:
I hope this helps