From: Ian B. <ia...@co...> - 2004-02-17 18:40:20
|
jws...@ra... wrote: > I should clarify- I, as the app do not care about the lesser tables. > I, as the programmer want to do as little typing as possible to > accomplish the task. The schema is the map and all the necessary > information is in there to build the classes automatically. When I > define my classes, I would like to be able to say Here are my object > names, here are my root tables, go build it. If I could get by with > only defining my public(app-facing)classes and letting SO build > whatever private(internal) classes it needs, I would be ecstatic, but > that's likely hoping for too much. Well, from what you're saying, all you really want is something that finds all the tables and creates classes from scratch. Like _fromDatabase, only actually creating all the classes. (I also think _fromDatabase isn't so good at foreign key identification, but that's fixable, at least for Postgres) That seems much more doable. You'd still have to do various traversals. Like, if you have a one-to-many relationship between A and B, and B has an attribute "email", then you have to do a.b.email, instead of simply a.email -- that's a separate feature entirely, and seems particularly difficult to solve while also doing automatic class generation. (Probably not impossible, maybe not even difficult, but not where you want to start) Anyway, Maxwell Hammer had a note about automatic class generation a couple days ago. Expanding tableExists to find all tables is easy enough. You'd probably want to run this automatic class generation after you instantiate your Smart Classes (i.e., ones that have actual business logic), and then that would fill in all the missing tables. Oh, and you have to fix _fromDatabase so that it detects foreign keys, and can find classes based on table name. But altogether a fairly doable plan. Ian |