From: Peter Rabbitson <ribasushi@cpan.org>
Date: Fri, 13 Mar 2015 12:43:08 +0000 (+0100)
Subject: Relax sanity check in _resolve_relationship_condition
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4b79657;p=dbsrgits%2FDBIx-Class.git

Relax sanity check in _resolve_relationship_condition

It doesn't buy much and breaks legitimate class redirection techniques
(some of them even documented in the cookbook)
---

diff --git a/Changes b/Changes
index 5c9c049..104efbd 100644
--- a/Changes
+++ b/Changes
@@ -8,6 +8,9 @@ Revision history for DBIx::Class
     * Fixes
         - Protect destructors from rare but possible double execution, and
           loudly warn the user whenever the problem is encountered (GH#63)
+        - Relax the 'self_result_object' argument check in the relationship
+          resolution codepath, restoring exotic uses of inflate_result
+          http://lists.scsys.co.uk/pipermail/dbix-class/2015-January/011876.html
         - Fix updating multiple CLOB/BLOB columns on Oracle
         - Fix incorrect collapsing-parser source being generated in the
           presence of unicode data among the collapse-points
diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm
index f75f393..4b8f1dd 100644
--- a/lib/DBIx/Class/ResultSource.pm
+++ b/lib/DBIx/Class/ResultSource.pm
@@ -1904,11 +1904,11 @@ sub _resolve_relationship_condition {
 
   $args->{condition} ||= $rel_info->{cond};
 
-  $self->throw_exception( "Argument 'self_result_object' must be an object of class '@{[ $self->result_class ]}'" )
+  $self->throw_exception( "Argument 'self_result_object' must be an object inheriting from DBIx::Class::Row" )
     if (
       exists $args->{self_result_object}
         and
-      ( ! defined blessed $args->{self_result_object} or ! $args->{self_result_object}->isa($self->result_class) )
+      ( ! defined blessed $args->{self_result_object} or ! $args->{self_result_object}->isa('DBIx::Class::Row') )
     )
   ;