Changing table name dynamically.

0 views
Skip to first unread message

revjoe

unread,
Apr 11, 2008, 9:08:23 PM4/11/08
to Php Object Generator
Is it possible to extend a pog class to change the table used to
retrieve records from?

I have many tables, each with the same structure, that for many
reasons cannot be consolidated. I have a page that retrieves records
from one table using POG and displays the records. I would like to
extend the class so that when I create the class I can do something
like $class->setTable("2"); then run $class->GetList($array); to get
the records from that table.

Is it theoretically possible, and can anyone point me in the right
direction?

Thanks!

Crispy

unread,
Apr 15, 2008, 7:43:16 PM4/15/08
to Php Object Generator
yes - it is possible to rewrite a POG object to do that, but I don't
think that
follows the 5th normal form that we encourage.

what you would be doing is making the POG interface into a generic
tool
for accessing the oddly highly similar database tables. I'd recommend
generating the POG object that is close, then modify all things that
reference
the table into a passed in variable or whatever. It won't be as clean,
but it would
suffice, I think.
Reply all
Reply to author
Forward
0 new messages