[Dbix-class] joins -- Can't Handle this Yet?

Matt S Trout dbix-class at trout.me.uk
Thu Nov 13 20:58:38 GMT 2008


On Wed, Oct 29, 2008 at 07:29:11AM +0100, Brandi Cantarel wrote:
> Thanks Cory for your response, but I am quite familiar with all of  
> the online help.
> After already consulting this and being able to write lots and lots  
> of good statements.  I have noticed that when use the table object  
> and join it to a table it "belongs_to"  I get the "Can't handle this  
> error"
> 
> But if I do the opposite join I do not get the error.  Why??
> 
> __PACKAGE__->belongs_to('entry' => 'Cazy::Schema::Entry','entry_id');
> __PACKAGE__->add_relationship('entry' =>  
> 'Cazy::Schema::Entry','entry_id');
> __PACKAGE__->might_have('entry_orgname' =>  
> 'Cazy::Schema::EntryOrgname','entry_id');
> __PACKAGE__->add_relationship('entry_orgname' =>  
> 'Cazy::Schema::EntryOrgname','entry_id');

Those add_relationship calls are invalid, as you keep being told.

Delete them.

You should only ever have -either- a belongs_to/might_have/has_manyt/has_one
-or- an add_relationship for any given rel, the first four are all convenience
wrappers that call add_relationship for you - and the arguments are *not* the
same to add_relationship and you haven't called it right.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list