gabriel1836 wrote:I have several instances that represent Class Table Inheritance with a base table like Person and then tables that contain type-specific information like User, Prospect, etc.
What is the difference between Person, User, and Prospect? Person and user seem to be the same thing to me. Prospect seems like it would differ by a boolean: 1= prospect or 2 = client. I guess I don't see the need to class table inheritance unless you have an existing deep inheritance hierarchy that somebody else wrote and you're not able to rewrite them. Otherwise, I'd say stick to one table per class.
gabriel1836 wrote:Does anyone have suggestions on how to do this better or does this sound like a valid way of handling the situation?
My suggest would be to make a Gateway for each unique domain object. The gateway is responsible for getting the data for that single object, whether that means querying one table or ten. The gateway is also responsible for persisting that object.
gabriel1836 wrote:I acknowledge the extra expense of having to perform at least two queries: One to determine type, and a second to get the data from the proper fields. It does complicate the object-relational-mapping but I'm confused as to why no one appears to have written or done anything with this idea in PHP. It doesn't seem like it should be that impossible.
It's not impossible, it's just a lot of work. Personally, I rarely use inheritance anyways. Composition is much more flexible and easier to test.