[Bast-commits] r5118 - in
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk:
lib/DBIx/Class/ResultSet t/lib t/var
zby at dev.catalyst.perl.org
zby at dev.catalyst.perl.org
Thu Nov 13 08:12:39 GMT 2008
Author: zby
Date: 2008-11-13 08:12:38 +0000 (Thu, 13 Nov 2008)
New Revision: 5118
Modified:
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/RunTests.pm
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/var/dvdzbr.db
Log:
hashrefs in m2m
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm
===================================================================
--- DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm 2008-11-13 07:34:26 UTC (rev 5117)
+++ DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm 2008-11-13 08:12:38 UTC (rev 5118)
@@ -55,10 +55,16 @@
# many to many case
if( $self->is_m2m( $name ) ) {
my ( $pk ) = $self->_get_pk_for_related( $name );
- my @values = @{$updates->{$name}};
my @rows;
my $result_source = $object->$name->result_source;
- @rows = $result_source->resultset->search({ $pk => [ @values ] } ) if @values;
+ for my $elem ( @{$updates->{$name}} ){
+ if( ref $elem ){
+ push @rows, $result_source->resultset->find( $elem );
+ }
+ else{
+ push @rows, $result_source->resultset->find( { $pk => $elem } );
+ }
+ }
my $set_meth = 'set_' . $name;
$object->$set_meth( \@rows );
}
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/RunTests.pm
===================================================================
--- DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/RunTests.pm 2008-11-13 07:34:26 UTC (rev 5117)
+++ DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/RunTests.pm 2008-11-13 08:12:38 UTC (rev 5118)
@@ -18,7 +18,7 @@
my $updates = {
id => undef,
aaaa => undef,
- tags => [ '2', '3' ],
+ tags => [ '2', { id => '3' } ],
name => 'Test name',
# 'creation_date.year' => 2002,
# 'creation_date.month' => 1,
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/var/dvdzbr.db
===================================================================
(Binary files differ)
More information about the Bast-commits
mailing list