Hi all,
I have a PHP OOP design question. I've done some searching in google, but wasn't able to turn up anything concrete. I'm hoping some experts can point me to the most elegant solution. 🙂
I have a set of classes. All of my classes "extend" an abstract class called Base. (This class reads a config file, has a basic set of common methods, and sets up needed parameters)
Most of my classes need a class called Mysql to perform database operations.
Is the best way to access the Mysql class to pass it in the __constructor in each of my child classes, or to instantiate it in my Base class, and assign it to a public property? Or perhaps there is a better way altogether?
I'm really looking for the best way to do this, so thanks in advance for your advice!