Protect DBIC as best we can from the failure mode in 7cb35852
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship / HasMany.pm
index 664f4fd..053eda6 100644 (file)
@@ -3,7 +3,7 @@ package # hide from PAUSE
 
 use strict;
 use warnings;
-use Try::Tiny;
+use DBIx::Class::_Util 'dbic_internal_try';
 use namespace::clean;
 
 our %_pod_inherit_config =
@@ -28,12 +28,13 @@ sub has_many {
       $guess = "using our class name '$class' as foreign key source";
     }
 
-    # only perform checks if the far side appears already loaded
-    if (my $f_rsrc = try { $f_class->result_source_instance } ) {
-      $class->throw_exception(
-        "No such column '$f_key' on foreign class ${f_class} ($guess)"
-      ) if !$f_rsrc->has_column($f_key);
-    }
+# FIXME - this check needs to be moved to schema-composition time...
+#    # only perform checks if the far side appears already loaded
+#    if (my $f_rsrc = dbic_internal_try { $f_class->result_source_instance } ) {
+#      $class->throw_exception(
+#        "No such column '$f_key' on foreign class ${f_class} ($guess)"
+#      ) if !$f_rsrc->has_column($f_key);
+#    }
 
     $cond = { "foreign.${f_key}" => "self.${pri}" };
   }
@@ -45,6 +46,7 @@ sub has_many {
     join_type => 'LEFT',
     cascade_delete => $default_cascade,
     cascade_copy => $default_cascade,
+    is_depends_on => 0,
     %{$attrs||{}}
   });
 }