Injecting relationships in DBIx::Class

Posted by Carl on Stack Overflow See other posts from Stack Overflow or by Carl
Published on 2010-04-23T18:29:56Z Indexed on 2010/04/23 18:33 UTC
Read the original article Hit count: 237

Filed under:
|

I have a handful of DBIx::Class::Core objects that model various database tables.

For some of those models (those that have a 'queue' column), I have another class inject subs (basically, to 'move' the model object along it's queue states).

I'd like to also have that class inject has_many relationships ala

class($name)->has_many('queue_history','MySchema::Result::QueueHistory',
 { 'foreign.record_id'=>'self.id' },
 { where => { type => $name }} );

but I can't seem to get the relationships to register properly (keep getting "No Such Relationship" errors - however, when calling the relationship method on the sources provides back the relationship).

Any clues as to what's wrong?

© Stack Overflow or respective owner

Related posts about perl

Related posts about dbixclass