From d5e0c363032486e064fe5cf4fba61153060c65f9 Mon Sep 17 00:00:00 2001 From: zby Date: Wed, 6 May 2009 19:12:19 +0000 Subject: [PATCH] using non-column, non-relation methods --- lib/DBIx/Class/ResultSet/RecursiveUpdate.pm | 7 +++++++ t/var/dvdzbr.db | Bin 37888 -> 37888 bytes 2 files changed, 7 insertions(+) diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 884cf05..8992718 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -40,6 +40,7 @@ sub recursive_update { # relations that that should be done after the row is inserted into the database # like has_many and might_have my %post_updates; + my %other_methods; my %columns_by_accessor = _get_columns_by_accessor( $self ); for my $name ( keys %$updates ) { @@ -51,6 +52,9 @@ sub recursive_update { $columns{$name} = $updates->{$name}; next; } + if( !( $source->has_relationship($name) && ref( $updates->{$name} ) ) ){ + $other_methods{$name} = $updates->{$name}; + } next if !$source->has_relationship($name); my $info = $source->relationship_info($name); if ( @@ -78,6 +82,9 @@ sub recursive_update { for my $name ( keys %columns ) { $object->$name( $updates->{$name} ); } + for my $name ( keys %other_methods) { + $object->$name( $updates->{$name} ) if $object->can( $name ); + } for my $name ( keys %pre_updates ) { my $info = $object->result_source->relationship_info($name); _update_relation( $self, $name, $updates, $object, $info ); diff --git a/t/var/dvdzbr.db b/t/var/dvdzbr.db index 73c1fcd598d63602623953b284c2cc14118a6dae..7eb36bb5e2e1d46db41dc335067c2696c02c0a08 100644 GIT binary patch delta 1041 zcma)*T})I*6vt=InZ3KL3$nPdz%J|pg2>12Dhk?GD=GHDr0T;4N^7(jHb7n67*;+s zCLGk5w29?%)M{!q-6viegSYX?#1|iYQWKM=4}IXR#57GbH8B{a2bL%{edyddbN_el z%)S3PznRHdn4E>_$`XBDy{)G$dHyv}gc4E17R#UsQK1xVi zK#kHORp*R}7cNVEU+Mes1A5L?{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