From: Peter Rabbitson Date: Sat, 12 Jul 2014 11:52:45 +0000 (+0200) Subject: Move a CDBI escape to the CDBI class hierarchy X-Git-Tag: v0.082800~143 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ee333775;hp=8e40a627f9c94df8ae46c1c1abc6f7abdb3fdfdf;p=dbsrgits%2FDBIx-Class.git Move a CDBI escape to the CDBI class hierarchy --- diff --git a/lib/DBIx/Class/CDBICompat/Relationships.pm b/lib/DBIx/Class/CDBICompat/Relationships.pm index 58b29e0..3ce3ef5 100644 --- a/lib/DBIx/Class/CDBICompat/Relationships.pm +++ b/lib/DBIx/Class/CDBICompat/Relationships.pm @@ -200,4 +200,8 @@ sub search { $self->next::method($where, $attrs); } +sub new_related { + return shift->search_related(shift)->new_result(shift); +} + 1; diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index e2f6224..2868250 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -641,8 +641,6 @@ sub new_related { # sanity check - currently throw when a complex coderef rel is encountered # FIXME - should THROW MOAR! - 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'" ); @@ -664,7 +662,6 @@ sub new_related { map { "'$_'" } @unspecified_rel_condition_chunks )); } - } return $self->search_related($rel)->new_result($values); }