[Bast-commits] r3977 -
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Sun Jan 27 08:41:01 GMT 2008
Author: ilmari
Date: 2008-01-27 08:41:01 +0000 (Sun, 27 Jan 2008)
New Revision: 3977
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm
Log:
Only get $self->{schema}->source($local_moniker) once.
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm 2008-01-27 05:05:04 UTC (rev 3976)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm 2008-01-27 08:41:01 UTC (rev 3977)
@@ -201,15 +201,14 @@
my $remote_method = 'has_many';
# If the local columns have a UNIQUE constraint, this is a one-to-one rel
- my $primary = [ $self->{schema}->source($local_moniker)->primary_columns ];
- if (_array_eq($primary, $local_cols) ||
+ my $local_source = $self->{schema}->source($local_moniker);
+ if (_array_eq([ $local_source->primary_columns ], $local_cols) ||
grep { _array_eq($_->[1], $local_cols) } @$uniqs) {
$remote_method = 'might_have';
$local_relname = $self->_inflect_singular($local_relname);
}
# If the referring column is nullable, make 'belongs_to' an outer join:
- my $local_source = $self->{schema}->source($local_moniker);
my $nullable = grep { $local_source->column_info($_)->{is_nullable} }
@$local_cols;
More information about the Bast-commits
mailing list