[Dbix-class] New user with JOIN problem

Matt S Trout dbix-class at trout.me.uk
Wed May 13 16:14:16 GMT 2009


On Wed, May 13, 2009 at 04:16:33PM +0100, Chris Cole wrote:
> Chris Cole wrote:
> > David Ihnen wrote:
> > Apologies. I used the DBIx::Class::Schema::Loader module to load the
> > schema so I didn't have it explicitly. However, I got it to dump the
> > schema to file.
> > 
> >> But I'm going to suspect that MirbaseHairpinMatch.pm MUST have a line
> >> something like this in it
> >>
> >> __PACKAGE__->belongs_to('seq_data', 'Whatever::seq_data', { 'foreign.id'
> >> => 'self.query_id' });
> > 
> > Close. It's:
> > __PACKAGE__->belongs_to("query_id", "My::Schema::SeqData", { id =>
> > "query_id" });
> > 
> 
> I forgot to ask. When using the DBIx::Class::Schema::Loader how does one
> find out the relationship names in the schema? Must the schema always be
> dumped to file or is there a method for reporting the relationship names?

You should always dump it to disk - it can happily regenerate a dumped schema
that you've added code to anyway.

Look at the DBIx::Class::Schema::Loader::Base docs for ways to control the
relation names - you probably want 'query' rather than 'query_id' for e.g.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/



More information about the DBIx-Class mailing list