From: Arthur Axel 'fREW' Schmidt Date: Tue, 10 Jul 2012 18:50:03 +0000 (-0500) Subject: fixup! Add flag for correctly introspecting fk rels X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a93e33563dfc017f514b616ffb424ed59272f13c;p=dbsrgits%2FDBIx-Class.git fixup! Add flag for correctly introspecting fk rels See note on 7347eb83c7c102356eda51cc6ad904e4ed920ede --- diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 693ebae..3ea6e6e 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -309,7 +309,7 @@ related object, but you also want the relationship accessor to double as a column accessor). For C accessors, an add_to_* method is also created, which calls C for the relationship. -=item is_foreign_rel +=item relationship_target_owns_me This is automatically set for all of the relationship helper methods. This is basically a flag that allows us to correctly introspect true foreign keys; diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index d56a89f..4b6c6a2 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -18,8 +18,8 @@ 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 $attrs->{is_foreign_key_constraint}; + $attrs->{relationship_target_owns_me} = 1 + if not $attrs->{relationship_target_owns_me}; $attrs->{is_foreign_rel} = 1 if not exists $attrs->{is_foreign_rel}; diff --git a/lib/DBIx/Class/Relationship/HasMany.pm b/lib/DBIx/Class/Relationship/HasMany.pm index 47822ea..1e5cfce 100644 --- a/lib/DBIx/Class/Relationship/HasMany.pm +++ b/lib/DBIx/Class/Relationship/HasMany.pm @@ -51,8 +51,8 @@ sub has_many { my $default_cascade = ref $cond eq 'CODE' ? 0 : 1; - $attrs->{is_foreign_rel} = 0 - if not $attrs->{is_foreign_rel}; + $attrs->{relationship_target_owns_me} = 0 + if not $attrs->{relationship_target_owns_me}; $class->add_relationship($rel, $f_class, $cond, { accessor => 'multi', diff --git a/lib/DBIx/Class/Relationship/HasOne.pm b/lib/DBIx/Class/Relationship/HasOne.pm index 212b54b..fa69fcf 100644 --- a/lib/DBIx/Class/Relationship/HasOne.pm +++ b/lib/DBIx/Class/Relationship/HasOne.pm @@ -53,8 +53,8 @@ sub _has_one { my $default_cascade = ref $cond eq 'CODE' ? 0 : 1; - $attrs->{is_foreign_rel} = 0 - if not $attrs->{is_foreign_rel}; + $attrs->{relationship_target_owns_me} = 0 + if not $attrs->{relationship_target_owns_me}; $class->add_relationship($rel, $f_class, $cond,