Re: Constraining a Class

[prev] [thread] [next] [Date index for 2005/07/12]

From: Aaron Trevena
Subject: Re: Constraining a Class
Date: 16:56 on 12 Jul 2005
On 7/12/05, Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Tue, Jul 12, 2005 at 11:08:03AM +1000, Rick Measham wrote:
> > I have a table 'Company' in my database. This table holds all manner of
> > companies: Customers, Potential Customers, Previous Customers, Supplier=
s
> > etc. There's an enum field that tells me which sort of company each row
> > represents.
> > I'd like to be able to create My::Data::Customer,
> > My::Data::PotentialCustomer etc., representing each of these types of
> > record in the table.
>=20
> This isn't really how Class::DBI works. Each class represents a table.
>=20
> However, have a look at Class::DBI::Relationship::HasVariant (from
> CPAN). I haven't used it, so I can't speak for it, but I believe it does
> something along these lines.

I'd say you could use the IsA Relationship with Company as the
superclass and the variants as subclasses.

This is probably closest to what you are looking for.

A.

Constraining a Class
Rick Measham 01:08 on 12 Jul 2005

Re: Constraining a Class
Tony Bowden 07:42 on 12 Jul 2005

Re: Constraining a Class
Aaron Trevena 16:56 on 12 Jul 2005

Re: Constraining a Class
Todd Lorenz 17:14 on 12 Jul 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52