I've this current trouble with data i must represent inside a MySQL database:
I must support different types of items with various data each one of these, for instance, cars, rooms in hotels, books, etc. For my application there's some data that is common for every product, like title, description, cost, etc.
And So I think about getting an item table, with common data, with cars, hotel_rooms, books and whatever tables referencing the product table inside a 1:1 relationship.
The issue is getting the merchandise table like a master table, in order to query the merchandise table and obtain the additional data "automagically" with individuals queries, in order to result in the application more "generic".
Any ideas of methods is this accomplished? I've got a couple of ideas, however i don't believe those are the easiest way to do it and I'd rather not choose dirty hacks if this problem might be more prevalent than I believe.
Using: PHP + Zend Framework + MySQL.
Possess a base object, then use polymorphism to subclass that base object. The bottom object stores all of the shared data (in 1 table).. Then each subclass has it's unique qualities and sources them from the separate table key'd in to the base table. Result in the subclasses able to loading both common data using their parent object, aswell as loading their ownOrunique data.