I’ve got a number of product classes which extend a parent product class. Each of these implements its own version of a PRODUCT_ID const. A method in a customer object will pull the PRODUCT_ID ‘s from the DB. I’d then like to instanciate the relevant product object and add it to an array.
Any ideas how I can dynamically find out which product object has the specific PRODUCT_ID const?
Sorry if that is a bit confusing!
The only way to do this would be to first loop through all of the declared classes, then check if they’re a subclass of the parent product and finally to check if the PRODUCT_ID constant is defined and equal to the product you’re looking for.
Here an example: