From: Christian Walde Date: Fri, 1 Mar 2013 13:54:17 +0000 (+0100) Subject: rename occurences of belongs_to in code and comments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c008e0fcb98b42197723e3d84342c95b97b6fc0;p=dbsrgits%2FDBIx-Class.git rename occurences of belongs_to in code and comments --- diff --git a/lib/DBIx/Class/CDBICompat/Relationships.pm b/lib/DBIx/Class/CDBICompat/Relationships.pm index 58b29e0..8c28a79 100644 --- a/lib/DBIx/Class/CDBICompat/Relationships.pm +++ b/lib/DBIx/Class/CDBICompat/Relationships.pm @@ -56,7 +56,7 @@ sub _declare_has_a { }; } else { - $self->belongs_to($col, $f_class); + $self->refers_to($col, $f_class); $rel_info = $self->result_source_instance->relationship_info($col); } diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index e2adbd8..bd6eb1b 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -65,7 +65,7 @@ sub refers_to { # dunno else { $class->throw_exception( - 'third argument for belongs_to must be undef, a column name, '. + 'third argument for refers_to must be undef, a column name, '. 'or a join condition' ); } diff --git a/lib/DBIx/Class/Relationship/HasOne.pm b/lib/DBIx/Class/Relationship/HasOne.pm index 09ea77c..6eb2b32 100644 --- a/lib/DBIx/Class/Relationship/HasOne.pm +++ b/lib/DBIx/Class/Relationship/HasOne.pm @@ -94,7 +94,7 @@ sub _validate_has_one_condition { unless $class->has_column($key); my $column_info = $class->column_info($key); if ( $column_info->{is_nullable} ) { - carp(qq'"might_have/has_one" must not be on columns with is_nullable set to true ($class/$key). This might indicate an incorrect use of those relationship helpers instead of belongs_to.'); + carp(qq'"might_have/has_one" must not be on columns with is_nullable set to true ($class/$key). This might indicate an incorrect use of those relationship helpers instead of refers_to.'); } } } diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 60d0d92..ba5ac0d 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -2130,7 +2130,7 @@ sub populate { my @pks = $rsrc->primary_columns; - ## do the belongs_to relationships + ## do the refers_to relationships foreach my $index (0..$#$data) { # delegate to create() for any dataset without primary keys with specified relationships diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 527d5e5..757dca7 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -198,7 +198,7 @@ sub parse { my @refkeys = map {/^\w+\.(\w+)$/} @cond; my @keys = map {$rel_info->{cond}->{$_} =~ /^\w+\.(\w+)$/} @cond; - # determine if this relationship is a self.fk => foreign.pk (i.e. belongs_to) + # determine if this relationship is a self.fk => foreign.pk (i.e. refers_to) my $fk_constraint; #first it can be specified explicitly diff --git a/lib/SQL/Translator/Producer/DBIx/Class/File.pm b/lib/SQL/Translator/Producer/DBIx/Class/File.pm index 0af77d7..459da3f 100644 --- a/lib/SQL/Translator/Producer/DBIx/Class/File.pm +++ b/lib/SQL/Translator/Producer/DBIx/Class/File.pm @@ -121,11 +121,11 @@ __PACKAGE__->table('${tname}'); # print Data::Dumper::Dumper($cont->type); if($cont->type =~ /foreign key/i) { -# $output .= "\n__PACKAGE__->belongs_to('" . +# $output .= "\n__PACKAGE__->refers_to('" . # $cont->fields->[0]->name . "', '" . # "${dbixschema}::" . $cont->reference_table . "');\n"; - $tableextras{$table->name} .= "\n__PACKAGE__->belongs_to('" . + $tableextras{$table->name} .= "\n__PACKAGE__->refers_to('" . $cont->fields->[0]->name . "', '" . "${dbixschema}::" . $cont->reference_table . "');\n";