[Dbix-class] Relationship::Base join-free exception question
Peter Rabbitson
rabbit+dbic at rabbit.us
Mon Jul 6 05:28:20 GMT 2015
On 07/06/2015 02:44 AM, Marco Palma wrote:
> Hey all, I'm hoping someone can clarify for me an exception that get's
> thrown in Relationship::Base. I'm have multipurpose comments table that
> could be used for commenting on different kinds of objects in a schema.
> Rather than having individual join-tables to cement the relationships,
> I want to using a compound foreign key of object_type + object_id.
>
> ...
> Which comes from the *new_related* method:
>
> $self->throw_exception("Custom relationship '$rel' does not resolve
> to a join-free condition fragment")
> if $crosstable;
>
> If I comment that check out, I can use the above has_many without issue.
Actually this is not exactly the case. Your "new related" object does
not have any of its FKs set to values coming from the "left-side" object.
> So I'm curious:
>
> - What is that exception meant to overcome?
> - Why must my relationship resolve to a "join-free" condition?
>
Before we go further - have you carefully read
https://metacpan.org/pod/DBIx::Class::Relationship::Base#Custom-join-conditions,
especially the paragraph starting with "While every coderef-based
condition must return..."
If after (re)reading this you are still unsure what this is all about -
don't hesitate to ask.
Cheers!
More information about the DBIx-Class
mailing list