X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FHasOne.pm;h=7935a2b1ebdef73bfec3208d01ad3e5d7f271487;hb=3334d204fcbbddedd73a7f63a285bdda9cb3e031;hp=f1c9ccc8682038190b153628bc4139c4eac1a79e;hpb=9e7525a2cc9d7459ee89a6d2c85913a8b8c4eff9;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/HasOne.pm b/lib/DBIx/Class/Relationship/HasOne.pm index f1c9ccc..7935a2b 100644 --- a/lib/DBIx/Class/Relationship/HasOne.pm +++ b/lib/DBIx/Class/Relationship/HasOne.pm @@ -35,7 +35,10 @@ sub _has_one { $class->ensure_class_loaded($f_class); $f_rsrc = try { - $f_class->result_source_instance; + my $r = $f_class->result_source_instance; + die "There got to be some columns by now... (exception caught and rewritten by catch below)" + unless $r->columns; + $r; } catch { $class->throw_exception( @@ -54,13 +57,14 @@ sub _has_one { } } - # only perform checks if the far side was not preloaded above *AND* - # appears to have been loaded by something else (has a rsrc_instance) - if (! $f_rsrc and $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 was not preloaded above *AND* +# # appears to have been loaded by something else (has a rsrc_instance) +# if (! $f_rsrc and $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); +# } $cond = { "foreign.${f_key}" => "self.${pri}" }; }