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!

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to