Re: dynamic creation of Class::DBI derived classes
[prev]
[thread]
[next]
[Date index for 2004/12/07]
Hi,
inspired by both posts I searched CPAN and found:
Class::DBI::Relationship::HasVariant
This, in combination with Class::DBI::Loader should do
the trick.
Thanks!
Emile
--- Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Mon, Dec 06, 2004 at 05:20:55PM -0800, Emile Aben
> wrote:
> > ItemAttribute has a few more columns that are the
> > cause of my problem. There is a 'is_reference'
> column,
> > if this is not NULL then the value in 'name'
> should be
> > interpreted as the name of another table that
> contains
> > more information on what possible values there are
> for
> > this attribute. Say there is a ItemAttribute row:
> > id 10,
> > name Contact,
> > is_reference 1
> > This would mean the thing stored in ItemData with
> > itemattribute 10 is the primary key of the table
> > 'Contact' (which might look like: (id, first_name,
> > last_name) or something).
>
> If I read this correctly (which I may well not be),
> you're going down
> completely the wrong path to solve this. Rather than
> creating dynamic
> classes, you just want to want to write a
> Class::DBI::Relationship type
> that represents that model.
>
> You could have a look at
> Class::DBI::Relationship::MightHave and change
> it to look up a table dynamically based on the value
> in a different
> column, rather than one it's given at compile time.
>
> If you get stuck, just shout; there are a few people
> here who have done
> things like this that should be able to help.
>
> Tony
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250