Re: variation of "weak link" lookup table
[prev]
[thread]
[next]
[Date index for 2004/06/24]
On Wed, Jun 23, 2004 at 08:47:05PM -0500, step2@xxxxxxxxxxxxxxxx.xxx wrote:
> artist ( artistid, name )
> artistaliast ( artistid1, artistid2 )
> ArtistAlias->table('artistalias');
> ArtistAlias->columns(Primary => qw/artistid1 artistid2/);
> ArtistAlias->has_a(artistid1 => 'Artist');
> ArtistAlias->has_a(artistid2 => 'Artist');
> Artist->table('artist');
> Artist->columns(Primary => 'artistid');
> Artist->columns(All => qw/artistid name/);
> Artist->has_many(tracks => ['TrackArtist' => 'trackid']);
> Artist->has_many(aliases => ['ArtistAlias' => 'artistid1']);
I'm not sure that that last line is correct. As you've multiple columns
pointing to the same table in ArtistAlias you're going to need the 3rd
argument to has_many. I would have thought that you'll want:
Artist->has_many(aliases => ['ArtistAlias' => 'artistid2'], 'artistid1');
Tony
|
|
Re: variation of "weak link" lookup table
Tony Bowden 07:23 on 24 Jun 2004
|