From: Brandon Black Date: Mon, 6 Feb 2006 14:54:46 +0000 (+0000) Subject: 0.01003 - fixed has_many cond rels X-Git-Tag: 0.03000~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5de0b0cf2d382da24bc717b0b13676ba5f26ebb;p=dbsrgits%2FDBIx-Class-Schema-Loader.git 0.01003 - fixed has_many cond rels --- diff --git a/Changes b/Changes index 071d36b..5280932 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader +0.01003 Mon Feb 6 14:57:56 UTC 2006 + - Fixed the has_many side of _make_cond_rel + 0.01002 Fri Feb 3 23:14:38 UTC 2006 - Email address typo :( diff --git a/META.yml b/META.yml index 79e5b89..2d202fd 100644 --- a/META.yml +++ b/META.yml @@ -20,7 +20,7 @@ build_requires: provides: DBIx::Class::Schema::Loader: file: lib/DBIx/Class/Schema/Loader.pm - version: 0.01002 + version: 0.01003 DBIx::Class::Schema::Loader::DB2: file: lib/DBIx/Class/Schema/Loader/DB2.pm DBIx::Class::Schema::Loader::Generic: diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 3d8fd13..8d83679 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -10,7 +10,7 @@ use UNIVERSAL::require; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -our $VERSION = '0.01002'; +our $VERSION = '0.01003'; __PACKAGE__->mk_classaccessor('loader'); diff --git a/lib/DBIx/Class/Schema/Loader/Generic.pm b/lib/DBIx/Class/Schema/Loader/Generic.pm index 373c725..8e0498b 100644 --- a/lib/DBIx/Class/Schema/Loader/Generic.pm +++ b/lib/DBIx/Class/Schema/Loader/Generic.pm @@ -223,6 +223,11 @@ sub _make_cond_rel { my $rev_cond = { reverse %$cond }; + for (keys %$rev_cond) { + $rev_cond->{"foreign.$_"} = "self.".$rev_cond->{$_}; + delete $rev_cond->{$_}; + } + my $cond_printable = _stringify_hash($cond) if $self->debug; my $rev_cond_printable = _stringify_hash($rev_cond) diff --git a/t/dbixcsl_common_tests.pm b/t/dbixcsl_common_tests.pm index d3163c9..7497f1f 100644 --- a/t/dbixcsl_common_tests.pm +++ b/t/dbixcsl_common_tests.pm @@ -37,7 +37,7 @@ sub skip_tests { sub run_tests { my $self = shift; - plan tests => 41; + plan tests => 42; $self->create(); @@ -105,7 +105,7 @@ sub run_tests { is( $obj2->id, 2 ); SKIP: { - skip $self->{skip_rels}, 28 if $self->{skip_rels}; + skip $self->{skip_rels}, 29 if $self->{skip_rels}; my $moniker3 = $monikers->{loader_test3}; my $class3 = $classes->{loader_test3}; @@ -147,6 +147,10 @@ sub run_tests { my $obj4 = $rsobj4->find(123); isa_ok( $obj4->fkid, $class3); + my $obj3 = $rsobj3->find(1); + my $rs_rel4 = $obj3->search_related('loader_test4s'); + isa_ok( $rs_rel4->first, $class4); + # fk def in comments should not be parsed my $obj5 = $rsobj5->find( id1 => 1, id2 => 1 ); is( ref( $obj5->id2 ), '' );