Practical question about usage of inheritance in php. I'm pretty new to this.
The project I'm working on encloses a.o. multiple charts which are all built up from data out of a database.
I've created multiple php classes. One class 'Filters' is inherited by all other classes. Filters connects to the DB and calculated and holds all arrays of selected filters and participants and the corresponding data.
2 classes, one class which creates the page Headers and one class which creates the Selectboxes, are used on each individual page (also inherits from Filters). And each individual page uses a class which creates a specific chart, which also inherits and uses a lot of variables from Filters. So each chart-page uses Filters + Header + Selectboxes + 'SpecificChart', the last 3 Classes inherit from Filters.
It all works perfectly. But because php does not support multiple inheritance, I created a function addFilters() to copy all necessary variables to use in the different classes, so I do not have to instantiate Filters multiple times.. I instantiate Filters and pass the object filters to the constructors of the other classes which call addFilters().
I was wondering if there's a better solution to this? Without the need to copy all the variables several times? I hope my explanation is clear..;)