X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FLazyLoading.pm;h=a9e41af5178e0422220484a1282d8eb6755d8914;hb=5e0eea3522876a30453af24097507198bbbc9409;hp=e07579a3fe89abe89ee3b48de15a0054fde1bed3;hpb=e4d970edd7f7fe71787d2b7ca754980fd92727cb;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index e07579a..a9e41af 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + sub resultset_instance { my $self = shift; my $rs = $self->next::method(@_); @@ -12,16 +14,16 @@ sub resultset_instance { } -# Emulate that CDBI throws out all changed columns and reloads them on +# Emulate that CDBI throws out all changed columns and reloads them on # request in case the database modifies the new value (say, via a trigger) sub update { my $self = shift; - + my @dirty_columns = keys %{$self->{_dirty_columns}}; - + my $ret = $self->next::method(@_); $self->_clear_column_data(@dirty_columns); - + return $ret; } @@ -30,12 +32,12 @@ sub update { sub create { my $class = shift; my($data) = @_; - + my @columns = keys %$data; - + my $obj = $class->next::method(@_); return $obj unless defined $obj; - + my %primary_cols = map { $_ => 1 } $class->primary_columns; my @data_cols = grep !$primary_cols{$_}, @columns; $obj->_clear_column_data(@data_cols); @@ -46,7 +48,7 @@ sub create { sub _clear_column_data { my $self = shift; - + delete $self->{_column_data}{$_} for @_; delete $self->{_inflated_column}{$_} for @_; } @@ -71,7 +73,7 @@ sub copy { for my $col ($self->primary_columns) { $changes->{$col} = undef unless exists $changes->{$col}; } - + return $self->next::method($changes); }