X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FBase.pm;h=20a9c17dda55cab38b4a22a3583c4d43d2315b4c;hb=3f8affda61edb3a04cf3ed3b8349c06f3d5c7858;hp=b4dc4d2ee3968b503b592e054d36642fbd66fe3c;hpb=5d2588ccdd92a01535fefd77c45240f75e8ec090;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index b4dc4d2..20a9c17 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -225,7 +225,7 @@ hashref which does not depend on joins being available, but the hashref must contain only plain values/deflatable objects, such that the result can be passed directly to L. For instance the C constraint in the above example prevents the relationship -from being used to to create related objects (an exception will be thrown). +from being used to create related objects (an exception will be thrown). In order to allow the user to go truly crazy when generating a custom C clause, the C<$args> hashref passed to the subroutine contains some extra @@ -297,7 +297,7 @@ For a 'belongs_to relationship, note the 'cascade_update': =item \%column A hashref where each key is the accessor you want installed in the main class, -and its value is the name of the original in the fireign class. +and its value is the name of the original in the foreign class. MyApp::Schema::Track->belongs_to( cd => 'DBICTest::Schema::CD', 'cd', { proxy => { cd_title => 'title' }, @@ -640,8 +640,10 @@ sub new_related { if (ref $self) { # cdbi calls this as a class method, /me vomits my $rsrc = $self->result_source; + my $rel_info = $rsrc->relationship_info($rel) + or $self->throw_exception( "No such relationship '$rel'" ); my (undef, $crosstable, $cond_targets) = $rsrc->_resolve_condition ( - $rsrc->relationship_info($rel)->{cond}, $rel, $self, $rel + $rel_info->{cond}, $rel, $self, $rel ); $self->throw_exception("Custom relationship '$rel' does not resolve to a join-free condition fragment")