Re: [Dbix-class] Detecting a "belongs_to" relationship.

2010-03-24 Thread Bill Moseley
On Wed, Mar 24, 2010 at 7:53 AM, fREW Schmidt wrote: > I'll only answer your last issue, since it doesn't make any sense at all in > DBIC context: > > ... > __PACKAGE__->set_primary_key(qw( part_id customer_id )); > ... > > The above class has a MultiPK. In general I don't like MultiPK but the >

Re: [Dbix-class] Detecting a "belongs_to" relationship.

2010-03-24 Thread fREW Schmidt
On Wed, Mar 24, 2010 at 12:55 AM, Rolf Schaufelberger wrote: > >> >> >my $artist = $cd->artist; # hits the database again >> >my $artist_id = $artist->id; >> > >> >> I define my relationships like that : >> >> belongs_to ( artist => 'My::Schema::Artist','artist_id' ); >> >> so >> $cd->art

Re: [Dbix-class] Detecting a "belongs_to" relationship.

2010-03-24 Thread Bill Moseley
On Wed, Mar 24, 2010 at 12:55 AM, Rolf Schaufelberger wrote: > > >my $artist = $cd->artist; # hits the database again > >my $artist_id = $artist->id; > > > > I define my relationships like that : > > belongs_to ( artist => 'My::Schema::Artist','artist_id' ); > > so > $cd->artist gives me

Re: [Dbix-class] Maybe a Regression? Without a primary key, prefetches fail.

2010-03-24 Thread Peter Rabbitson
J. Shirley wrote: > I'm not sure if this counts as a regression, but it was for me :) > > I have a class which is defined as: > > package MyApp::Schema::StupidJoinTable; > > use strict; > use warnings; > > use base 'DBIx::Class'; > > __PACKAGE__->load_components("Core"); > > __PACKAGE__->tabl

Re: [Dbix-class] Detecting a "belongs_to" relationship.

2010-03-24 Thread Rolf Schaufelberger
Am 24.03.2010 um 04:44 schrieb Bill Moseley: > > In my music database I have CD objects that belong to an Artist. I want the > artist primary key but I don't want to hit > the database (or do a join with a prefetch) just to get the id. > >my $artist = $cd->artist; # hits the database aga