How should this Class be written in php? Composition, Inheritance, Decorator?
I have a database where people might simultaneously be employees, customers and members of a company. My adminstration system allows me to edit the properties of the Person, Employee, Customer and Member objects on independent pages.
Now, I'd like to be able to call up a Person but be able to view and edit their employee, customer and member properties on the same page. Creating a view for this scenario is trivial, but I'd like to do it properly with the correct specification of base class, inheritances, compositions and aggregates, etc.
I do understand that the employees, customers and members can't exist without the person, so for my admin page, I'm thinking I should create a new class, UberDude, that is a composition of the person, employee, customer and member classes. I would also like to use this new class as part of a collection so that I could draw a table of all persons and see whether they are employees, customers or members. Something doesn't seem right and I can't work out the code for the class structure. Any ideas?