X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FBelongsTo.pm;h=471a417fc82c9b3a9b1d8ed3d125c283a3b24fbb;hb=956f4141284c6b2f216de47a09ffa16928df38fc;hp=5756f2b7fad98d452811fc8baa9fd119e96c4ca0;hpb=4ff1b819f21a2fe72d46008920639bd25b9dbb8f;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index 5756f2b..471a417 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -7,24 +7,31 @@ package # hide from PAUSE use strict; use warnings; +our %_pod_inherit_config = + ( + class_map => { 'DBIx::Class::Relationship::BelongsTo' => 'DBIx::Class::Relationship' } + ); + sub belongs_to { my ($class, $rel, $f_class, $cond, $attrs) = @_; + + # assume a foreign key contraint unless defined otherwise + $attrs->{is_foreign_key_constraint} = 1 + if not exists $attrs->{is_foreign_key_constraint}; + $attrs->{undef_on_null_fk} = 1 + if not exists $attrs->{undef_on_null_fk}; + # no join condition or just a column name if (!ref $cond) { $class->ensure_class_loaded($f_class); - my %f_primaries = map { $_ => 1 } eval { $f_class->primary_columns }; + my %f_primaries = map { $_ => 1 } eval { $f_class->_pri_cols }; $class->throw_exception( - "Can't infer join condition for ${rel} on ${class}; ". - "unable to load ${f_class}: $@" + "Can't infer join condition for ${rel} on ${class}: $@" ) if $@; my ($pri, $too_many) = keys %f_primaries; $class->throw_exception( "Can't infer join condition for ${rel} on ${class}; ". - "${f_class} has no primary keys" - ) unless defined $pri; - $class->throw_exception( - "Can't infer join condition for ${rel} on ${class}; ". "${f_class} has multiple primary keys" ) if $too_many; @@ -72,12 +79,14 @@ sub belongs_to { return 1; } -=head1 AUTHORS - -Alexander Hartmaier - -Matt S. Trout +# Attempt to remove the POD so it (maybe) falls off the indexer -=cut +#=head1 AUTHORS +# +#Alexander Hartmaier +# +#Matt S. Trout +# +#=cut 1;